Sendmail help

dyanamo

Senior Member
Joined
Jun 19, 2007
Messages
942
Reaction score
2
Location
Cape Town - Strand
Hi. We are using sendmail to send out emails and all works wonderful until the email is rejected by the recipient. My PHP (phpmailer) is all good. Set the ReplyTo and From address and this works when the recipient exists or there isnt a problem. As soon as theres a problem the email gets bounced back to the server generating the email instead of the person in the replyto and from field. Is there a setting (config file) anywhere in sendmail that can force or errors to be bounced back to the replyto field?

Thanks
 
AFAIK this is not possible in terms of SMTP & MIME headers.

Have a look through the POP3, SMTP and MIME rfc's you'll see all the fields that are supported. These three "protocols" are extremly well documented in their rfc's.

I'm pretty sure you'd have to configure the mail server to forward the returned error mail back to the person who send it. That's what MS Exchange and the rest of the guys do.
 
You need to send Return-Path - mail servers don't care about From or Reply-To, only mail clients do. You will probably see in your logs that the mail comes from something like [email protected] instead of the From address.
 
Yeah thats right. So where is the sendmail config file for returnpath? Hopefully can code/edit it to take the value of the return-to field.
 
Yeah thats right. So where is the sendmail config file for returnpath? Hopefully can code/edit it to take the value of the return-to field.

You don't set this in the MTA. You do this in your application. For PHP:
http://uk.php.net/function.mail

The two things to look at are the extra headers and -f parameter. There are some specific examples of the extra headers here:

http://uk.php.net/manual/en/function.mail.php#88302
http://uk.php.net/manual/en/function.mail.php#75955
http://uk.php.net/manual/en/function.mail.php#57725

the -f parameter is discussed on the same page, near the top, under "Example #3 Sending mail with an additional command line parameter." It looks more or less like this:

Code:
mail($recipient, $subject, $message, $additional_headers, -f$sender);

Looks like I was wrong, well done. Reply-To seems like the way to do this!

No. Reply-To is an MUA header. It *may* be that the particular mail host you're mailing to works this into their spam filtering, and fixing it takes away the problem for this particular recipient. But not setting the correct Return-Path will screw you sooner or later.

You also need to make sure that your server has proper DNS set up. I.e. the hostname that sendmail provides during SMTP conversation should exist as an A record pointing to the server's primary IP (or whichever IP it uses for outgoing mail), and the sending IP should have a reverse DNS matching the hostname.
 
The reply-to is set and working but the return-path regardless of what I do to it in PHP always gets set to the MUA return-path. Thats why I need to change it or find a setting that configures/sets it to the the reply-to address.
Been looking all over the internet and this seems to be a common problem. Aswell dont use mail but phpmailer in sendmail mode.
 
Last edited:
The reply-to is set and working but the return-path regardless of what I do to it in PHP always gets set to the MUA return-path. Thats why I need to change it or find a setting that configures/sets it to the the reply-to address.
Been looking all over the internet and this seems to be a common problem. Aswell dont use mail but phpmailer in sendmail mode.


This is from the RFC I posted:
4.3.1. RETURN-PATH
This field is added by the final transport system that delivers the message to its recipient. The field is intended to contain definitive information about the address and route back to the message's originator.

Note: The "Reply-To" field is added by the originator and serves to direct replies, whereas the "Return-Path" field is used to identify a path back to the originator.

While the syntax indicates that a route specification is optional, every attempt should be made to provide that information in this field.

Does this not mean that as a "client" it's not possible to change this field? And the mail server needs to get the message send to the "Return-Path" field and forward it back to the client in the "Reply-To" field?

That's what the RFC is saying to me...........?
 
Does this not mean that as a "client" it's not possible to change this field?

The MUA can specify both. The difference is just that the a mail server doesn't care about Reply-To, but it cares about Return-Path, and if it's not specified, it will add the username who generated the mail + server's hostname.

And the mail server needs to get the message send to the "Return-Path" field and forward it back to the client in the "Reply-To" field?

If the message cannot be delivered, the server will return it to the address in the Return-Path field. As I said before, mail servers don't care about Reply-To and From.
 
Look for 'sendmail_path' in php.ini. If someone put a -f in there, it will override whatever you set. But you shouldn't use this to set what you need, because it will set it the same for all domains. The place to set this is in the application generating the mail, i.e. your website.
 
Top
Sign up to the MyBroadband newsletter
X