1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 谷歌邮箱无法与服务器建立连接失败 GMAIL SMTP错误:无法连接到服务器

谷歌邮箱无法与服务器建立连接失败 GMAIL SMTP错误:无法连接到服务器

时间:2019-12-05 15:56:30

相关推荐

谷歌邮箱无法与服务器建立连接失败 GMAIL SMTP错误:无法连接到服务器

我正在使用PHP中的Gmail SMTP发送电子邮件 . 我还在php.ini中启用了OPENSSL . 但是我收到了这个错误 .

SMTP - >错误:无法连接到服务器:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接主机无法响应而 Build 连接失败 . (10060)以下发件人地址失败:mhtkumar46@:未连接时调用Mail()发送邮件失败 .

这是我的代码 .

error_reporting(E_ALL);

require("PHPMailer_5.2.4/class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP(); // set mailer to use SMTP

$mail->SMTPDebug = 2;

$mail->Debugoutput = 'html';

$mail->From = "mhtkumar46@";

$mail->FromName = "Mohit";

$mail->Host = ""; // specif smtp server

$mail->SMTPSecure= "tls"; // Used instead of TLS when only POP mail is selected

$mail->Port = 587; // Used instead of 587 when only POP mail is selected

$mail->SMTPAuth = true;

$mail->Username = "mhtkumar46@"; // SMTP username

$mail->Password = "*******"; // SMTP password

$mail->AddAddress("mohitkumarsingla60@", "Singla"); //replace myname and mypassword to yours

$mail->AddReplyTo("mhtkumar46@", "Mohit");

$mail->WordWrap = 50; // set word wrap

//$mail->AddAttachment("c:\\temp\\js-bak.sql"); // add attachments

//$mail->AddAttachment("c:/temp/11-10-00.zip");

$mail->IsHTML(true); // set email format to HTML

$mail->Subject = 'test';

$mail->Body = 'test';

if($mail->Send()) {echo "Send mail successfully";}

else {echo "Send mail fail";}

?>

我无法找到解决方案 . 请帮我 .

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。