esport Posted March 5, 2008 Share Posted March 5, 2008 Hi Guys, I just recently moved my website over to a new serer and noticed my mail function is not working. The recipients are not receiving their emails, yet the results show true when the mail function is used. However if I send and email to a hotmail or yahoo account, it works fine. And it also works fine if i send an email locally, as to an email account with the same domain name. I have made several adjustments to my code hoping it would change the outcome. Below is the code i am using. ini_set ("SMTP","mail.pitpro.com.au"); ini_set('sendmail_from',"[email protected]") $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: Pitpro Motorcycles <[email protected]>\r\n"; $headers .= "To: ".$name." ".$surname." <".$email.">\r\n"; $headers .= "Reply-To: Pitpro Motorcycles <[email protected]>\r\n"; $headers .= "Return-Path: Pitpro Motorcycles <[email protected]>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: PHP"; $subjectText="Order Confirmation - PitPro Australia"; mail($email, $subjectText, $body, $headers,"-f [email protected]"); The code looks fine to me and I have no idea why its not working. Any help would be much appreciated. Thanks Daniel Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/ Share on other sites More sharing options...
esport Posted March 5, 2008 Author Share Posted March 5, 2008 Has it got something to do with my server settings? Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-484366 Share on other sites More sharing options...
networkthis Posted March 5, 2008 Share Posted March 5, 2008 Comment out 1 line at a time when all else fails Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-484386 Share on other sites More sharing options...
esport Posted March 6, 2008 Author Share Posted March 6, 2008 The code has worked in the pass and as I mentioed before, it works fine with hotmail and yahoo accounts and local accounts. I believe it sends ok but the other end doesn't recieve the email. Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-484445 Share on other sites More sharing options...
esport Posted April 3, 2008 Author Share Posted April 3, 2008 Still no luck why certain emails wont even receive any emails whats so ever. Its killing me. My hotmail account and the local emails receive them. Ahhhh Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-508181 Share on other sites More sharing options...
NikkiLoveGod Posted April 3, 2008 Share Posted April 3, 2008 It is not a problem with your PHP, especially if messages sent to hotmail, etc accounts are sent from that same script. And according to my experiences, it does return true when trying to send the message, but looses it while the server is trying to send it... So you need to consult your provider to solve this one... They might have some filters set or something. Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-508207 Share on other sites More sharing options...
devstudio Posted April 3, 2008 Share Posted April 3, 2008 It is indeed most-likely a server problem. You should be getting a mailer daemon at the reply-to address. Try changing the reply-to address to one of your hotmail accounts. If you could see a mailer-daemon, my guess would be something with the RCPTHOSTS config: Error 553. In a nutshell, the server you are trying to send from isn't authenticated or allowed to send messages to the SMTP server you are mailing to, but for whatever odd reason is acting with authority when routing mail to hotmail. Best, Nathan Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-508211 Share on other sites More sharing options...
hassank1 Posted April 3, 2008 Share Posted April 3, 2008 what's the function of "ini_set" ? Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-508252 Share on other sites More sharing options...
devstudio Posted April 4, 2008 Share Posted April 4, 2008 Sets a configuration option in your ini file. (http://us3.php.net/ini_set) ini_set ("SMTP","mail.pitpro.com.au"); -- Sets your SMTP server in PHP ini to the server listed. ini_set('sendmail_from',"[email protected]") -- Sets your return address in PHP ini. -- btw, just noticed this line doesn't have a semicolon terminating the end. Perhaps if you have errors surpressed, this is just a simple parse error? Best, Nathan Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-509031 Share on other sites More sharing options...
ansarka Posted April 4, 2008 Share Posted April 4, 2008 only a note to add is your server windows or linux if you are using windows server in headers you have to put \r\n if you are using linux server in headersyou have to put \n only Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-509049 Share on other sites More sharing options...
hassank1 Posted April 4, 2008 Share Posted April 4, 2008 Sets a configuration option in your ini file. (http://us3.php.net/ini_set) ini_set ("SMTP","mail.pitpro.com.au"); -- Sets your SMTP server in PHP ini to the server listed. ini_set('sendmail_from',"[email protected]") -- Sets your return address in PHP ini. -- btw, just noticed this line doesn't have a semicolon terminating the end. Perhaps if you have errors surpressed, this is just a simple parse error? Best, Nathan if I am using shared hosting and I don't have access to php.ini ! can I still use this function ? and what this ini_set('sendmail_from',"[email protected]") differe from $header="from:xyz..." ? Link to comment https://forums.phpfreaks.com/topic/94401-mail-function-not-working-not-receiving-emails/#findComment-509056 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.