Sending emails through SMTP with PHPMailer

前端 未结 8 883
情深已故
情深已故 2020-12-31 07:13

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.

相关标签:
8条回答
  • 2020-12-31 07:42

    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:

    • Some SMTP servers can forbid connections from "outsiders".
    • Some SMTP servers don't support SSL (or TLS) connections.

    Maybe this example can help (GMail secure SMTP).

    [Source]

    0 讨论(0)
  • 2020-12-31 07:49

    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.

    0 讨论(0)
提交回复
热议问题