Using VERP for bounce handling

    • Using VERP for bounce handling

      Recently I switched the forum over from Debian to CentOS. Mail was working fine on the Debian box but had no real need for a specific bounced mail account since I just shipped it all to an alias.

      With the new version of XenForo having the ability to monitor bounced email I decided to put it into place on this site. This is using the standard install of CentOS 6.5 with (as of this post) the current stable Centmin Mod.

      With the change all my email outbound was going fine, but I began to notice that I could not get any inbound email. Spend almost 2 hours looking at the configs trying to figure out what was wrong. Nothing that I could see. Finally decide to check the MX record - and that was the one thing I hadn't changed with the server move. Off I go to my DNS server to update that entry.

      So, now I have inbound email coming in to the system just fine - great, time to enable the bounce feature.

      Set up an account just for the bounced mail on the system and create a mail directory for it (since I use dovecot for imap logins it is recommended). Get all that working just fine, can log into imap from remote and grab mail from another test account.

      Time to set up a test account on the forum with a trash email.

      Alrighty, here we go. Test user created, set them (just for fun) as valid via the ACP and they have a bad email address. From the ACP I pick that user to send an email to.

      The Postfix mail log shows we have outbound and inbound email (this is the inbound back to me from Google - I used a test email on my Google Apps domain)

      Source Code

      1. [font='Open Sans']Aug 31 17:50:04 poomba postfix/smtp[24981]: 61E2E160CC3: to=<>,[]:25, delay=0.37, delays=0.07/0.01/0.24/0.05, dsn=5.1.1, status=bounced (host[] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 t28si3565833yhg.94 - gsmtp (in reply to RCPT TO command))[/font]

      and when the mail gets processed for the bounced function by postfix this is what was reported in the mail log.

      Source Code

      1. [font='Open Sans']Aug 31 17:50:04 poomba postfix/local[24733]: BF425160CC4: to=<>, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.1.1, status=bounced (unknown user: "")[/font]

      Pay special attention to the area after [color=rgb(179, 0, 0)]unknown user:[/color], it will come in handy near the end of this diatribe.

      After a bunch of head scratching and a little reading of the Postfix manual I realize I'm missing something from my for Postfix.

      It's a very simple little thing, the matter of 21 characters

      Source Code

      1. recipient_delimiter = +

      Here is where it comes in useful. Remember all those nasty little [color=rgb(179, 0, 0)]+[/color] between the names and number stuff before the domain? Here is where we define what is being used.

      End result of adding that small config setting?

      Source Code

      1. Aug 31 18:21:13 poomba postfix/local[29330]: 285B7160CC2: to=<>, relay=local, delay=0.12, delays=0.1/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
      2. Aug 31 18:21:13 poomba postfix/qmgr[27015]: 285B7160CC2: removed

      Once that was added in, we now have successful bounced mail processing for XenForo (all the other Postfix/Dovecot configs are another matter).