I\'m trying to send SMTP e-mails using PHPMailer, but I keep getting this error message, any ideas how to get rid of it?
I\'m trying to connect via SSL on port 465.
As far as I can see everything is right with your code. Your error is:
SMTP Error: Could not authenticate.
Which means that the credentials you've sending are rejected by the SMTP server. Make sure the host, port, username and password are good.
If you want to use STARTTLS, try adding:
$mail->SMTPSecure = 'tls';
If you want to use SMTPS (SSL), try adding:
$mail->SMTPSecure = 'ssl';
Keep in mind that:
Maybe this example can help (GMail secure SMTP).
[Source]
I had very similar problem for something like an hour, until I figured out what went wrong. My problem was, that I used SSL, instead of ssl. Check is case sensitive in the code. AlexV guided me to the source of the problem. That helo/ehlo -stuff seems irrelevant.