Add header with original recipient

Discussion in 'Server Operation' started by 127.0.0.1, Mar 2, 2012.

  1. 127.0.0.1

    127.0.0.1 New Member

    Hi guys,

    since last weeks I have a problem with my postfix configuration.

    Some of my postboxes are defined as catchall, but thats make it really hard to separate the mails. What I need is something like X-Sender in the header to determine the sender. I have activated the X-Original-To in postfix, but in my case it seems very useless, postfix just placed the mailbox name there like [email protected].

    After googeling a bit I added a regular expression file with

    Code:
    /(.+)/ PREPEND X-Sender: $1
    and added the line in Postfix right after

    Code:
    smtpd_recipient_restrictions = check_recipient_access pcre:/etc/postfix/append_header.regexp, (...)
    in the main.cf file. That works very well for one address, but if I send it to multiple recipents I have tons of multiple entries in the mail head.

    Code:
    X-Sender: user@...
    X-Sender: user2@
    ...
    So that is not really what I'm searching for, it breaks the Bcc and I think it's not good to have a lot of entries with the same description.

    In the last step I moved the entry to the smtpd_data_restrictions in main.cf. It work very well. But when I address more than one recipient, the X-Sender will not be added to the header...

    Have anyone some experience with that? I get a lot of mails from other users/provieder which have also that kind of header added. Is that probably not possible to add when I use postfix? And now i'm totally confused with the X-Delivered, X-Envelope.., X-Original stuff...

    Hope for help

    127.0.0.1
     
  2. 127.0.0.1

    127.0.0.1 New Member

    X-Original-To rewritten by Amavis

    I've found a solution by myself,

    the problem was amavis, which rewrites the X-Original-To. When you are using dovecot and amavis, as in my case.

    so just add:
    Code:
    receive_override_options = no_address_mappings
    in main.cf.

    in master.cf add
    Code:
    ...
    127.0.0.1:10025 inet n    -       n       -       -     smtpd
    ...
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
    and

    Code:
    ...
    dovecot	  unix	-	n	n	-	-	pipe
    	flags=DROhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
    I have found a lot of questions in Mailing lists, but no has a answer on the special problem.

    127.0.0.1

    PS: I've to admit, that this is not a rewrite, but adds the standard complaint header X-Original-To which is the same as X-Envelope in Exim.
     

Share This Page