php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = "ssl://smtp.gmail.com"
; http://php.net/smtp-port
smtp_port = 465
I would like to send email in php using gmail SMTP server and did change on php.ini(See above code). Also add $host, $port, $username and $pw into the sendEmail.php.
However, email still can not be sent out. Can anyone help me? Thanks!
sendEmail.php
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "username@googlemail.com";
$password = "password";
$email_to = "n.liu@the-imcgroup.com";
$email_subject = "Test E-Mail";
$email_body = "Email Body";
if(mail($email_to, $email_subject, $email_body)){
echo "The email was successfully sent.";
} else {
echo "The email was NOT sent.";
}
?>