0

We have a web app that sends email. Right now, if we send an email, and it is bounced (for whatever reason), no one knows since it comes from a no-reply address, which is never checked for bounces.

Some of these emails are very important, and we'd like to show the failed email attempt in the interface.

My thought is to do this:

  1. Inject an X-Header: guid-goes-here into the email to uniquely identify it.
  2. Create a milter in Postfix that will run the email through a script to parse out that header and (hopefully) at the same time capture the queue ID.
  3. Parse mail.log for that queue ID and get its disposition (250 OK).

For #2, when I create a milter, does postfix inject the queue ID when it pipes the mail to the script? I am in the early stages of this, and haven't gotten it to work yet. Also, I have chosen to use SMTP content filter in post-queue (http://www.postfix.org/FILTER_README.html). Is this the correct choice?

1 Answer 1

1

Simply use an address as the envelope sender that is actually monitored.

Do it like this:

  • make sure bounces@$yourdomain is delivered into a program (i.e. maybe via aliases or .forward)
  • change your application to send mail using this envelope sender scheme: bounces+recipient=recipientdomain@$yourdomain

As you can see, the initial recipient (recipient@recipientdomain) is encoded into the sender address you're using. If the mail bounces, it bounces back to bounces+recipient=recipientdomain@$yourdomain -- so with no parsing at all you can find out what address bounced!

That's called VERP and is used by mailing list managers like ezmlm or mailman: https://en.wikipedia.org/wiki/Variable_envelope_return_path

Your proposed approach is flawed, since the "250 OK" status doesn't really indicate that the mail won't be bounced by subsequent relays!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.