Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a postfix server that delivers mail and send a copy of the outgoing mail to a second server for content analysis using the following configuration (addresses and IPs have been replaced):

main.cf content

sender_bcc_maps = pcre:/$config_directory/sender_bcc

sender_bcc content

/^(.*)@(.*)$/                   ${1}@tst.example.com

transport_maps content

tst.example.com     smtp:[192.168.1.1]

Unfortunately, the configuration above doesn't preserve the envelop so I don't get the original recipient on the second server. The goal in having the original recipient is to catch BCCs. Is there a way to do it just by configuring Postfix? An example of a good result would be to have postfix add something like

x-bcc: test@example.com
or
x-original-recipient: test@example.com

to the email headers sent to the second server (and only them. We don't want to add a bcc header or anything like that to the email that is delivered to the users, obviously).

I've looked everywhere and haven't found anything to add the original recipient. Maybe there's another way? Any suggestion to reach the final goal is welcome!

share|improve this question

1 Answer 1

To enable postfix to save the original recipient of the mail, you can add the following line to your main.cf:

enable_original_recipient = yes

After this, your mail contains the following header:

X-Original-To: original.recipient@your.mailhost.com

But for content filtering or inspection, you should have a look at the milter interface (before you accept and queue a mail) of Postfix or the content_filter directive (after you accepted and queued a mail).

share|improve this answer

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.