setting reply-to in sendmail.mc
I'm using sendmail to send Mails from PHP and also forward some mails addressed to the server to a list of external mail-providers. The forwarding is done via an entry in /etc/mail/virtusertable:
[email protected] testuser
In my /etc/aliases I include the mail list file:
testuser: ":include:/home/mail-list"
This setup works so far but I wanted to ask how it is possible to change the Reply-To Header of mails sent to the virtual user testuser
via sendmail.mc? And if not is there another way to do this?
Solution 1:
The proper way to set Reply-To is to do it in the MUA (PHP in your case), not in the MTA.
Example:
$to = '[email protected]';
$subject = 'bla';
$message = 'bla';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n";
mail($to, $subject, $message, $headers);
More info: http://php.net/manual/en/function.mail.php
If you insist on rewriting addresses through sendmail, you shall use genericstable (see http://www.sendmail.com/sm/open_source/docs/m4/features.html#genericstable)
-
Add the following lines to sendmail.mc and recompile it:
GENERICS_DOMAIN('name.of.localhost')dnl
FEATURE(`genericstable')dnl
create a map in /etc/genericstable to translate outgoing addresses. The file looks like this:
localuser newuser@newdomain
- Convert the map to a hash db file by typing
makemap hash /etc/genericstable.db < genericstable