Jump to content

Unable to send mail to some addresses


svivian

Recommended Posts

I've been working on a contact form for a client that should email them when someone submits it. However, they are not receiving the emails. I've had it sending to my work address, gmail account and other addresses and we always receive it fine.

 

Apparently some ISPs reject email with a bad "Return-Path" header. I have tried setting this in my script in various ways but nothing has worked thus far - the return path is always wrong.

 

Here's the basic code:

$emailTo = 'CLIENT ADDRESS';
$emailSub = 'Rooms in Worcester enquiry';
$emailHead = "From: $name <$email>\r\n" . "Reply-To: $name <$email>\r\n";
$emailBody = '...';

if ( mail( $emailTo, $emailSub, $emailBody, $emailHead ) )
{
  ...
}

 

I've tried:

- using the "Return-Path" header, with just the email

- using the "Return-Path" header, with "name <email>"

- adding "-f$email" in the additional parameters

 

Does anyone know any other things I can try?

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/140924-unable-to-send-mail-to-some-addresses/
Share on other sites

Well, it may or may not help with your issue, but have you tried just using the "From:" bit in your mail function headers argument?  If the From and Reply-To are the same, I don't see why you need both.  Technically, you don't even need the From, either; the mail headers are an optional argument.

 

Also, check your php.ini file... A default SMTP address can be specified in there as the "From" address, I believe.

Don't put the email address from the contact form into the From: address. Put an email address hosted at the sending mail server.

 

The domain in the From: address must be either be the domain that corresponds to the sending mail server and you need a correct SPF record too or if the domain in the From: address is different than the domain of the sending mail server there must be an SPF record at the domain in the From: address that says that the sending mail server is authorized to send email for that domain.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.