PHPMailer saying could not connect to SMTP host

前端 未结 4 1521
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-24 09:30

For the past 2 days I\'ve been trying to get a PHP script to send an e-mail and it doesn\'t seem to work. First I\'ve tried the normal php mail function, then PHPMailer and then

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-24 09:40

    I have the same problem i tried with SSL with port 465 then it said services is unavailable then i try this thing it solve my problem hopefully it solve also yours 1) Make sure you use $mail->IsSMTP(); for the authentication. Ismail is only working for the same server with mail function

    2) This thing fix my problem

    $mail->SMTPSecure = "tsl"; 
    $mail->Port = 587;
    

    i add these two lines now email sending is perfectly working earlier i face this error SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting but above thing solve my problem hopefully it work for you thank you

提交回复
热议问题