I'm trying to send out mail using Google's SMTP in combination with PHPMailer, but I can't get it to work. This is my code:
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Username = "[email protected]";
$mail->Password = "**********";
$mail->Port = "465";
First I do not fully understand what should be filled in as 'SMTPSecure', some say 'ssl
', other say 'tls
'. Next for 'Port' I could enter '465' or '587'. But none of the combinations work... Note that I'm using a regular Gmail account and not Google Apps. In my Gmail account I've enabled 'POP access'.
The error I get is: "Must issue a STARTTLS command first
". Which means SSL failed, but don't know why...
Ok, the problem was the version of PHPMailer. I updated to PHPMailer version 5 and everything worked great. I was using phpMailer version 1.02.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With