dongtiaozhou4914 2019-01-15 22:39
浏览 158

xampp phpmailer发送电子邮件 - 连接错误10060

I am trying to send email from server which runs locally by xampp. Could you please help me to find possible solution?

I am sure I've used the correct email and password. SMPT port in php.ini and sendMail.ini is also set to port 25.

my php code:

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);                             
try {
    //Server settings
    $mail->SMTPDebug = 2;                                
    $mail->isSMTP();                                      
    $mail->Host = 'smtp.gmail.com';
    $mail->SMTPAuth = true;                               
    $mail->Username = 'mygmailadress@gmail.com';           
    $mail->Password = 'mypassword';                          

    $mail->Port = 25;
    $mail->setFrom('from@example.com', 'Mailer');
    $mail->addAddress('mygmailadress@gmail.com', 'Joe User');    

    $mail->isHTML(true);                                 
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}

PHP responded with error:

SERVER -> CLIENT: 421 Cannot connect to SMTP server 64.233.166.108 (64.233.166.108:25), connect error 10060

CLIENT -> SERVER: EHLO localhost

SERVER -> CLIENT:

SMTP ERROR: EHLO command failed:

SMTP NOTICE: EOF caught while checking if connected

SMTP Error: Could not authenticate.

SMTP Error: Could not authenticate.

Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.

Thank you :)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集