Jump to content

mail function not working - not receiving emails


esport

Recommended Posts

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

 

  • 4 weeks later...

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.

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

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

 

 

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..." ?

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.