简体   繁体   English

无法连接到服务器:连接超时(110)SMTP Connect()失败。 邮件未发送。邮件错误:SMTP Connect()失败

[英]Failed to connect to server: Connection timed out (110)SMTP Connect() failed. Message was not sent.Mailer error: SMTP Connect() failed

This is my code and still it is not sending the mail. 这是我的代码,仍然没有发送邮件。 What could be the problem? 可能是什么问题呢?

require 'class.phpmailer.php';// path to the PHPMailer class
require 'class.smtp.php';

            $mail = new PHPMailer();  

            $mail->IsSMTP();  // telling the class to use SMTP
            $mail->Mailer = "smtp";
            $mail->Host="smtp.gmail.com";
            $mail->SMTPSecure='tls';
            $mail->Port =465;             
            $mail->SMTPAuth = true; // turn on SMTP authentication
            $mail->Username = "mymailgmail.com"; // SMTP username
            $mail->Password = "mypassword"; // SMTP password 
            $mail->SMTPDebug = 1;

            $mail->AddAddress("mymail@gmail.com","Title");
            $mail->SetFrom($visitor_email, $name);
            $mail->AddReplyTo($visitor_email,$name);

            $mail->Subject  = "Message from  Contact form";
            $mail->Body     = $user_message;
            $mail->WordWrap = 50;  

            if(!$mail->Send()) {
            echo 'Message was not sent.';
            echo 'Mailer error: ' . $mail->ErrorInfo;
            } else {
            echo 'Message has been sent.';
            }

// header('Location: thank-you.html'); //标头(“位置:thank-you.html”); } }

I had similar issue sometime back. 有时我也遇到过类似的问题。 It turned out that the connection was attempted using ipv6 address. 原来,尝试使用ipv6地址进行连接。 It worked fine after removing IPv6 address from network interface. 从网络接口删除IPv6地址后,它工作正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 邮件无法发送.Mailer错误:SMTP连接()失败 - Message could not be sent.Mailer Error: SMTP connect() failed 邮件未发送。邮件程序错误:SMTP 连接()失败 - Message was not sent.Mailer error: SMTP connect() failed SMTP->错误:无法连接到服务器:连接超时(110) - SMTP -> ERROR: Failed to connect to server: Connection timed out (110) Mandrill:SMTP错误:无法连接到服务器:连接超时(110) - Mandrill : SMTP ERROR: Failed to connect to server: Connection timed out (110) PHPMailer的臭名昭著的SMTP错误:无法连接到服务器:连接超时(110)SMTP connect()失败 - PHPMailer's infamous SMTP ERROR: Failed to connect to server: Connection timed out (110) SMTP connect() failed PHPMailer SMTP无法连接到服务器:连接超时(110)到Gmail - PHPMailer SMTP Failed to connect to server: Connection timed out (110) to Gmail PHP Mailer错误:无法发送消息.Mailer错误:SMTP connect()失败 - PHP Mailer error: Message could not be sent.Mailer Error: SMTP connect() failed 我从phpmailer收到此错误消息无法发送。Mailer错误:SMTP connect()失败? - I am receiving this error from phpmailer Message could not be sent.Mailer Error: SMTP connect() failed? PhpMailer错误:无法发送邮件。Mailer错误:SMTP connect()失败 - PhpMailer error : Message could not be sent.Mailer Error: SMTP connect() failed SMTP->错误:无法连接到服务器:连接超时(110)以下“发件人”地址失败:xxxxx@gmail.com错误 - SMTP -> ERROR: Failed to connect to server: Connection timed out (110) The following From address failed: xxxxx@gmail.com ERROR
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM