Unable to send mail through Google SMTP with PHPMailer

Posted by bartclaeys on Stack Overflow See other posts from Stack Overflow or by bartclaeys
Published on 2009-05-01T08:39:29Z Indexed on 2010/03/24 4:03 UTC
Read the original article Hit count: 554

Filed under:
|
|

Hello,

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...

© Stack Overflow or respective owner

Related posts about phpmailer

Related posts about google