2

I have the following scenario:

[HTTP Server]: process messages

[SMTP Server]: only send messages

[HTTP Server] === connect to ===>>> [SMTP Server] === sends message ===>>> [world]

Ok, this is going well.

My point is: how to get feedback from [SMTP Server] to know if my message was really sent or not?

Using php-mailer or any language/api (in [HTTP Server]), I only have feedback for connection between servers: "Connection to SMTP server was OK", but this is not a proof that my message was really sent.

I mean, how to get that "status=sent" or "status=bounced" that appears in the /var/log/maillog for each message?

I am really trying this in the last weeks, but no success.

I worked in a way that, when [HTTP Server] connects to [SMTP Server], gets Message-ID from maillog, so later I'll go (SSH from [HTTP Server] to [SMTP Server]) to grep the /var/log/maillog with this Message-ID and gets this "status=sent" or "status=anything".

But I'm pretty sure there's an automated way to do that.

Does anyone know?

squillman
  • 37,883
  • 12
  • 92
  • 146

2 Answers2

2

The only way to know that you're catching NDR and similar is to have a valid from: or reply-to: address that will catch such things, and ensure that your SMTP server will generate and deliver those.

mfinni
  • 36,144
  • 4
  • 53
  • 86
2

That's how SMTP works, you send it on to the next server, and it will tell you if it accepted it, or not. What goes on beyond that requires some access to the relay server.

You could have the mail server mail you 5 minute segments of /var/log/maillog.. if you want it automated.

NickW
  • 10,263
  • 1
  • 20
  • 27