therealwesfoster Posted May 1, 2009 Share Posted May 1, 2009 This is weird and happens a lot. When I send an email from a php script mail("email@gmail.com","Literature Request",$msg); I receive the email in my GMAIL account, no problem. But when sending to any other email address (that ISN'T GMAIL), it doesn't get received. Not even in the spam folder. Whats up with that? Wes Quote Link to comment Share on other sites More sharing options...
the182guy Posted May 1, 2009 Share Posted May 1, 2009 Hotmail and Yahoo are notorious for this. It's basically their spam filters blocking the email. You haven't set any headers or the senders address, that is probably why they aren't being received, the spam filters just drops it. What I normally do to ensure the email gets through is set the from, reply-to and return path headers. Often the senders email address needs to be on the same server as the web server, and it also helps if the email account does actually exist. $headers = "From: mail@site.co.uk\r\n"; $headers .= "Reply-To: mail@site.co.uk\r\n"; $headers .= "Return-Path: mail@site.co.uk\r\n"; $success = mail($to, $subject, $body, $headers); Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted May 1, 2009 Author Share Posted May 1, 2009 and it also helps if the email account does actually exist That's my problem! No, not really I'll add those headers and let you know Wes Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted May 1, 2009 Author Share Posted May 1, 2009 Negatory, here's the new code: $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1 \r\n"; $headers .= "From: email@amil.com \r\n"; $headers .= "Reply-To: email@amil.com \r\n"; $headers .= "Return-Path: email@amil.com \r\n"; mail("me@gmail.com,another@mydomain.com","Literature Request",$msg,$headers); Quote Link to comment Share on other sites More sharing options...
the182guy Posted May 1, 2009 Share Posted May 1, 2009 Does the senders email address exist, and is the domain name of the email address pointing to the originating web server? Quote Link to comment Share on other sites More sharing options...
forced4 Posted May 28, 2009 Share Posted May 28, 2009 I do not want to hijack your post, but I too, have this issue. The only thing that is differnet is, I am trying to let others email me via a form on my page. I only get success when I test it with emails addys that are on my domain. Any other email ( they do exist ) from my isp or yahoo or gmail all gets failed response. Is this the same cause? P.S. I am really a newbie to this. Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted May 28, 2009 Author Share Posted May 28, 2009 Turned out to be a server issue for me. I changed servers and everything then worked perfectly as it should. So if you want to fix this problem, or simply find a better host, click here Wes Quote Link to comment Share on other sites More sharing options...
forced4 Posted May 29, 2009 Share Posted May 29, 2009 Ok, I don't know if this is a bad thing, but I changed the "from" field of my php to be "myemail@mywebsite.com" I left the rest of it the same and it seems to work 100% so far. I need to know if there is a better way. I can post the entire PHP if you'd like. It is very basic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.