Jump to content

Mail Functionality


NaniG

Recommended Posts

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: [email protected]' . "\r\n" .

    'Reply-To: [email protected]' . "\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.......

Link to comment
https://forums.phpfreaks.com/topic/240647-mail-functionality/
Share on other sites

what errors do you receive when adding this to your code?

<?php
$to='to@examplecom';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
if(mail($to, $subject, $message, $headers))
{
   echo "Mail sent Successfull";
}
else
{
   echo "Mail function fail";
   echo $php_errormsg;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/240647-mail-functionality/#findComment-1236000
Share on other sites

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.