Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

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

share|improve this answer

Try MSH Traffic Policy it's a milter for Postfix and Sendmail which will help you with your problematic scenario.

And it can do a lot more...

share|improve this answer
    
But you shouldn't. Violating the RFCs is not a good idea. –  mailq Nov 23 '12 at 17:43

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).

share|improve this answer

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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