【问题标题】:Could not send mail to other accounts apart from my own?无法将邮件发送到我自己以外的其他帐户?
【发布时间】:2014-03-27 11:55:34
【问题描述】:

我从 github 下载了PHPMailer 库并使用以下脚本发送邮件。我尝试将电子邮件发送到我自己的帐户,并且成功了。它打印“消息已发送”并在 gmail 中收到电子邮件。但是当我尝试向我朋友的帐户发送邮件时,他没有收到电子邮件。但是脚本说消息已发送。

<?php

include('PHPMailer-master/PHPMailerAutoload.php'); 
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "example@gmail.com";
$mail->Password = "examplepassword";
$mail->SetFrom("example@gmail.com");
$mail->Subject = "Test";
$mail->Body = "hello";
$mail->AddAddress("example2@gmail.com");
 if(!$mail->Send())
    {
    echo "Mailer Error: " . $mail->ErrorInfo;
    }
    else
    {
    echo "Message has been sent";
    }
?>

我正在使用 xampp。问题背后的原因是什么,我需要更改我的 gmail 设置中的任何设置吗?

编辑:现在我在 40 分钟后收到了第二个地址的邮件。但是当我发送它的第一个地址时,它会立即收到。不知道为什么?我想用它来验证邮箱,40分钟很长。

【问题讨论】:

  • 检查垃圾/垃圾邮件文件夹?您的电子邮件也在 gmail 中?
  • @user12 我已经检查了垃圾文件夹......是的..gmail

标签: php email smtp xampp phpmailer


【解决方案1】:

以下链接将为您提供帮助: 通过 PHP 邮件发送邮件很慢

  http://stackoverflow.com/questions/6380477/sending-emails-through-php-mail-is-slow

【讨论】:

  • 我的问题不在于脚本速度慢.....我的问题在于接收电子邮件....当我将电子邮件发送到我自己的地址时,它发送和接收速度很快。当我向其他人发送邮件时,脚本会立即执行,但邮件会在 >15 分钟后在收件人的 gmail 收件箱中收到
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-01-28
  • 1970-01-01
  • 2019-07-21
  • 2020-08-16
  • 2014-02-22
  • 1970-01-01
  • 2015-03-14
相关资源
最近更新 更多