laravel - Swift_TransportException:预期响应代码 250,但得到代码“”,带有消息“”
问题描述
我正在从 Gmail 帐户向自己发送错误电子邮件,并且它正在工作。
突然电子邮件崩溃了,我得到了
Swift_TransportException:预期响应代码 250,但得到代码“”,消息“”。
我不确定为什么会发生这种情况,我发送了大约 80 封电子邮件。
这是我的代码:
$backup = Mail::getSwiftMailer();
// Setup your gmail mailer
$transport = \Swift_SmtpTransport::newInstance($email_config['host'], $email_config['port'], $email_config['security']);
$transport->setUsername($email_config['from_email']);
$transport->setPassword($email_config['from_email_password']);
// Any other mailer configuration stuff needed...
$gmail = new \Swift_Mailer($transport);
// Set the mailer as gmail
Mail::setSwiftMailer($gmail);
$cc = $email_config["cc"];
$to_email = $email_config["to"];
\Log::info("mail 1");
\Log::info($to_email);
// Send your message
\Mail::send('emails.error_log', ['body' => $body], function ($message) use ($from_email, $to_email, $subject, $cc) {
$message->from($from_email);
$message->to($to_email);
$message->cc($cc);
$message->subject($subject);
});
\Log::info("mail 2");
// Restore your original mailer
Mail::setSwiftMailer($backup);
解决方案
推荐阅读
- android - 找不到 NativeScript 令牌拦截器
- reporting-services - SSRS:无法在浏览器中查看主文件夹,尤其是以管理员身份查看 Internet Explorer
- ms-wopi - WOPI客户端和主机查询
- javascript - 子组件未在状态更改时更新
- google-cloud-platform - 如何在 Google 的 GCP 上部署或安装 Cloudera CDH?
- javascript - axios 的包装函数
- r - R中的预测人数
- postgresql - 使用 kubectl apply 命令重新配置 postgres
- mysql - 错误号:1137 无法重新打开表:'d'
- swift - Swift:接受子类的协议