svivian Posted January 15, 2009 Share Posted January 15, 2009 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 More sharing options...
Schlo_50 Posted January 15, 2009 Share Posted January 15, 2009 I had the same problems with sending to hotmail email addresses, and it was down to invalid SPF records from my Web Hosts. Ran the script from a fasthosts hosting account and all was good. Google SPF Records (Sender Policy Framework) Link to comment https://forums.phpfreaks.com/topic/140924-unable-to-send-mail-to-some-addresses/#findComment-737619 Share on other sites More sharing options...
Zephyr_Pure Posted January 15, 2009 Share Posted January 15, 2009 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. Link to comment https://forums.phpfreaks.com/topic/140924-unable-to-send-mail-to-some-addresses/#findComment-737623 Share on other sites More sharing options...
PFMaBiSmAd Posted January 15, 2009 Share Posted January 15, 2009 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. Link to comment https://forums.phpfreaks.com/topic/140924-unable-to-send-mail-to-some-addresses/#findComment-737649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.