【发布时间】:2017-10-02 07:17:43
【问题描述】:
我正在使用Microsoft outlook SMTP 详细信息从我的网站向其他用户发送电子邮件。
我配置了队列/作业功能来发送电子邮件。
SMTP 设置
MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=info@abcxyz.com
MAIL_PASSWORD=abcyxz45
MAIL_FROM_NAME=ABC Mailer
MAIL_FROM_EMAIL=info@abcxyz.com
MAIL_ENCRYPTION=tls
派遣工作代码
$job = new SendReportEmail($job_data);
$this->dispatch($job);
邮件发送代码
class SendReportEmail extends Job implements SelfHandling, ShouldQueue
{
use InteractsWithQueue, SerializesModels;
var $data = null;
public function __construct($data)
{
$this->data = $data;
}
public function handle()
{
$response = $this->data['response'];
$EntrepreneurPdf = $response->pdf;
Mail::send('emailTemplates.imResults', ['response' => $response], function ($message) use ($response, $EntrepreneurPdf) {
$message->subject($response->subject);
$message->to($response->provider_email);
$this->checkForEntrepreneurReportAttachment($response, $message, $EntrepreneurPdf);
});
}
}
当我运行这个命令来执行排队的作业时
php artisan queue:listen --timeout=300
进程开始,有时我收到以下错误,因此由于错误和一次又一次排队尝试,我多次收到相同的电子邮件。
Processed: Illuminate\Queue\CallQueuedHandler@call [Swift_TransportException] Connection to tcp://smtp.office365.com:587 Timed Out
问题是什么,可能出在哪里?
【问题讨论】:
-
您可以使用这些凭据发送电子邮件而无需排队工作吗?
-
是的,我可以使用这些凭据发送电子邮件。正常的电子邮件和排队工作一样。但是在处理排队的作业时,我经常会遇到连接超时问题。
标签: php laravel tcp smtp office365