X-Envelope-To / X-Original-To Header for mail archive

NethServer Version: 7.9.2009
Module: postfix, dovecot
Hello,
We have recently started using Nethserver as our mail server and would now like to connect the SecurePoint UMA as our mail archive.

Unfortunately, I have not yet fully understood how to insert the X-Envelope-TO headers so that the archive can assign the emails.
I have created an archive@ mailbox and activated “Forward a copy of all messages” in the settings.

The only thing I have found on the subject is already 11 years old and I am not sure how to implement it with the e-smith templates.

https://mailing.postfix.users.narkive.com/P4OA8zgi/virtual-alias-maps-and-x-original-to

You can fake it in the SMTP server with

/etc/postfix/main.cf:
smtpd_recipient_restrictions =
check_recipient_access pcre:/etc/postfix/recipient_access.pcre

/etc/postfix/recipient_access.pcre
/(.+)/ prepend X-Original-To: $1

Thanks for your help

Update:
i got it working for incoming mails with

main.cf

smtpd_recipient_restrictions = check_client_access cidr:/etc/postfix/access.cidr,
 ... 
 check_recipient_access regexp:/etc/postfix/recipient_access

recipient_access
/(.+)/ PREPEND X-Original-To:$1
(dont use prepend:)

  • But i also need a header for outgoing mails!
  • And some instructions, how to put it into the e-smith template

THX

Hi and welcome to NethServer Community,

here is the documentation about custom templates.

In the case of /etc/postfix/main.cf you need to create the custom template directory /etc/e-smith/templates-custom/etc/postfix/main.cf first.

Add a fragment file like 90myconfig containing your configuration to the created directory.

Expand the template:

expand-template /etc/postfix/main.cf

Now main.cf should contain your additional configuration.

3 Likes

thanks for the help
yes, but a few questions are still open.

how do i update the templates?
i made changes on thursday, which were also present in the main.cf today. however, i don’t know why and didn’t manage to update them directly on thursday.

I still don’t know how to adjust the headers for outgoing mails?

I think I’ll make a new post about this and then link both solutions.

Just edit the custom template you created ( /etc/e-smith/templates-custom/etc/postfix/main.cf/90myconfig , for instance) and expand the template for the target file ( expand-template /etc/postfix/main.cf ).

Afterwards, the changes you made shall be present on /etc/postfix/main.cf. You can check this file to make sure the changes are reflected correctly (no syntax / formatting error…)

Remember the name of the template file matters at least to set the order in which the templates are processed to build the final target file.

Once you have it fully working do you mind to post a step by step howto here, so anyone else facing the same issue can use it?

Hello again,

I was not here for some time, because I started my own company.
Now it is so far that I will set up a Nethserver for my own company, accordingly I will also try the config again.

Of course the community will get a complete guide.