Is it possible to change Return-Path in Sendmail

sendmail

I just changed Return-Path in 2 of my servers which run Exim and Posfix. The third server runs Sendmail. I spent several hours trying to find information how to change it but can not find anything. So, I need to change Return-Path so that sent emails contain Return-Path: root@mydomain.com instead of root@my-servers-hostname.com.

I can not change the server's hostname itself because my data center wants additional 5 EUR/month for a custom PTR record.

Thanks.

Best Answer

I copy from the bat book:

There must be only one Return-Path: header in any mail message, and it should be placed there by the site performing final delivery. This header should be declared in the configuration file like this:

H?P?Return-Path: $g

The ?P? flag ensures that only delivery agents that perform final delivery insert this header. Those delivery agents are usually prog and local, which usually contain an F=P delivery agent flag

So if you want to set it to something else at the bottom of your sendmail.mc add the following lines:

LOCAL_CONFIG
H?P?Return-Path: blah-blah

Also note that if this header is already defined, then it cannot be replaced unless sendmail was compiled with H_ACHECK defined for conf.c.

Related Topic