We are using a postfix server for debuging a notification system. I want postfix send all mails back to the sender, that means whatever the recipient is, postfix will delivery the mail back to the sender.

Is it possible? If so, how can I do this?

  • 1
    Postfix sends mails back to sender in the case when sender sends mails to non-existing user or mail gets bounce. – user128296 Dec 1 '12 at 5:41
  • @user128296 This is true, but I expect Joseph wants something with a little more finesse and style than a typical NDR/Bounce :) – voretaq7 Dec 1 '12 at 15:08

For your particular use case it's probably best to do the following:

  1. Set up a "catchall" email account and have postfix deliver everything there.
  2. Set up procmail rules on the catchall account to send the messages back to their original sender.

Most modern Linux systems have procmail installed. If yours doesn't (or if you're not running Linux) it's a tiny program with few dependencies so installing it shouldn't be much of an issue.
Configuring procmail rules has a bit of a learning curve, but if you google around there are many excellent documents/tutorials to help get you started.

  • Thanks @voretaq7, I work around using sender_bcc_maps, bcc all emails to the sender, and of course, there is a catchall account. – Joseph Dec 2 '12 at 0:43
  • @Joseph You may want to post that as an answer - it sounds like a more elegant solution than what I suggested (I'm not really a postfix guy, so I'm used to working around sendmail's deficiencies with procmail - I jump to it more often than is probably needed if using an MTA that doesn't suck :-) – voretaq7 Dec 2 '12 at 1: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.