issues while sending email with xampp on localhost
I am working on a project in which I need to send email. My send mail function is:
ini_set('sendmail_path', "\"C:\xampp\sendmail\sendmail.exe\" -t");
ini_set('smtp_server', 'smtp.gmail.com');
ini_set('smtp_port', 25);
ini_set('smtp_ssl', 'auto');
ini_set('error_logfile', 'error.log');
ini_set('auth_username', 'myemailAddreds@gmail.com');
ini_set('auth_password', 'mygmail_password');
//sendmail_from('myemailAddreds@gmail.com');
$to = 'myemailAddreds@gmail.com';
$subject = 'Hello from XAMPP!';
$message = 'This is a test';
$headers = "From: your@email-address.com\r\n";
if (mail($to, $subject, $message, $headers)) {
echo "SUCCESS";
} else {
echo "ERROR";
}
But I am getting following error
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\umtab\xampp\htdocs\umtab\email.php on line 23
from Recent Questions - Stack Overflow https://ift.tt/3F27Lye
https://ift.tt/eA8V8J
Comments
Post a Comment