Postfix – Modify Recipient Address in Queue

emaillinuxpostfix

I have a few emails in my mailq which are bounced for a good reason, the email address is wrong.
I was wondering if it is possible to modify the address of the recipient on the fly.
I can see the directory where the mail deferred are stored and I could probably change something there, but i am wondering if there is a proper way to do this.

Any thought?

Best Answer

The best way (or the least intrusive way) would be to have an address rewrite for that recipient. From the Postfix Address Rewriting

/etc/postfix/main.cf:
    smtp_generic_maps = hash:/etc/postfix/generic

/etc/postfix/generic:
    his@localdomain.local       hisaccount@hisisp.example

Following this example, you could try:

cd /etc/postfix

Add to the generic file or create it with:

yourbadlyspelledname@destination.com        you_name@destination.com

and build the associated map:

sudo postmap generic

Add to main.cf:

smtp_generic_maps = hash:/etc/postfix/generic

make Postfix load this configuration change:

sudo postfix reload

smtpd will use generic to rewrite the problematic address upon next scan of queue.

Related Topic