Postfix: I would like to duplicate all incoming emails

I've followed the guides and successfully setup Postfix (in virtual user mode) and everything is working properly.

I would now like to setup a system to help monitor ALL incoming emails. Ideally I want to duplicate all messages to single email address (eg. log@domain.com) or out to a script. I want to log every single email (our volumes are not high) including those to mailboxes that don't exist. A catch-all address is no good because it only picks up an recipient not in the user table and I would still like to create the bounce to an email if the mailbox isn't there.

Is there not any way just to simply take a copy of every single email before passing onto the usual postfix queue for normal processing? It seems like something simple but I can't find any solutions on the net.

5 Replies

@Nuvini:

Like this?

No. recipientbccmaps only works after the email has been accepted for a particular mailbox. So it doesn't capture emails sent to an email box that doesn't exist

Note that there simply is no message to copy when a recipient doesn't exist – the rejection is done at the SMTP level. When you send an e-mail to an address that doesn't exist, the bounce e-mail itself is usually generated by your mail relay, not the recipient's server.

If you want to receive the message and then bounce it, you've got a bit of a problem: it's trivial to spoof e-mail addresses, so you'll be sending a bounce message to an e-mail address that is often some random third party. (This is called "backscatter", and is a considerable spam problem.)

@hoopycat:

Note that there simply is no message to copy when a recipient doesn't exist – the rejection is done at the SMTP level. When you send an e-mail to an address that doesn't exist, the bounce e-mail itself is usually generated by your mail relay, not the recipient's server.

Ah yes. Good point, I was envisaging a complete email being received and then rejected when postfix found the recipient didn't exist but you are right. If I think a bit harder I can see now that mail relay doesn't even get as far as sending the message to my server

Thanks

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct