NaniG Posted June 28, 2011 Share Posted June 28, 2011 Hi all, Am getting the error when am trying to send the email with my site. here is the php code to send an email... <?php $to='to@examplecom'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: from@example.com' . "\r\n" . 'Reply-To: rply@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)) { echo "Mail sent Successfull"; } else { echo "Mail function fail"; } ?> am using the CentOS with PHP 5.2.5, and i have changed SMTP details in the PHP.ini file to SMTP = mail.xxx.com smtp_port = 25 when am trying to execute the code, getting Mail function fail. Please can any body help me out from these issue....... Quote Link to comment Share on other sites More sharing options...
fugix Posted June 28, 2011 Share Posted June 28, 2011 what errors do you receive when adding this to your code? <?php $to='to@examplecom'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: from@example.com' . "\r\n" . 'Reply-To: rply@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)) { echo "Mail sent Successfull"; } else { echo "Mail function fail"; echo $php_errormsg; } ?> Quote Link to comment Share on other sites More sharing options...
NaniG Posted June 28, 2011 Author Share Posted June 28, 2011 From last 7 days the functionality is not working properly. Now the prob. has solved with out doing any thing. I don't know how it could be. Thanks fugix for reply...! Quote Link to comment Share on other sites More sharing options...
fugix Posted June 28, 2011 Share Posted June 28, 2011 I simply added some error_handling, which shouldn't have fixed the issue in itself. Did you figure out what was causing the error? Quote Link to comment Share on other sites More sharing options...
NaniG Posted June 28, 2011 Author Share Posted June 28, 2011 Nope...! 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.