0

In postfix, I'd like a way to deal with e-mail accounts that are no longer active by having postfix send the standard "Recipient address rejected" type message, but still forwarding the e-mail to another user. Thus, if someone sends an e-mail to employee.who.quit@example.com, it will bounce the message back to the sender for future reference, but the mail will still get forwarded to active.employee@example.com to deal with. .vacation and / or .forward files let me down because they will either reply or forward, but not both. Any tips?

  • What we do is use the .forward file to forward to the new employee + send an auto-reply giving the new contact. After a few months, we remove the old account and it's forwarding, and replace it with an entry in the relocated_maps, which rejects the mail with the new contact details in the error message text – mivk Nov 29 '16 at 11:07
2

You are violating RFC 5321. Don't to that! Rejecting mails is definitively okay in this case. Go for that.

| improve this answer | |
1

Rather than issuing a bounce and forwarding, you should issue an auto-reply and forward.

As observed in the answer by @mailq , what you're proposing violates an RFC, so you shouldn't do it, and probably won't find find many options for doing so. Instead, redirect it, and handle the auto-reply however you prefer (from the new address or the old one).

| improve this answer | |
-2

After looking at header_checks(5) and pcre_checks(5), I would experiment with putting something like this in the header_checks file:

if /^To: employee.who.quit*/
REDIRECT active.employee@example.com
REJECT "This individual no longer works at example.com."
endif

Now, the man paged I linked to says I can't use REJECT in header_check, but I haven't had a chance to look into why that might be true, and it may not be. (I can think of arguments both ways.) If REJECT doesn't work, I'd next experiment with FILTER to send the email to an MDA that would handle the reply to the sender.

Alternately, I might also look at .forward sending to an automated mail handler that does its own redirects and replies to sender.

| improve this answer | |
  • 2
    Rejected mails can't be forwarded. Forwarded mails can't be rejected. So both provided solutions don't work. – mailq Nov 23 '12 at 17:42

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.