I set up SMTP and smtp_port in php.ini file. And it's already there.
ini_set("SMTP","ssl://smtp.gmail.com");
ini_set("smtp_port","465");
Now, I am trying to send email by this:
$to = 'email@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: email@example2.com' . "\r\n" .
'Reply-To: email@example2.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
ERROR:
Message: mail(): Failed to connect to mailserver at
"ssl://smtp.gmail.com" port 465, verify your "SMTP" and
"smtp_port" setting in php.ini or use ini_set()
Is this because of authentication problem? I don't want to use PHPMailer
.