简体   繁体   English

Laravel队列,与tcp://smtp.office365.com的连接:587超时

[英]Laravel Queue, Connection to tcp://smtp.office365.com:587 Timed Out

I am using Microsoft outlook SMTP details for sending emails from my website to other users. 我正在使用Microsoft outlook SMTP详细信息从我的网站向其他用户发送电子邮件。

I configured Queue/Jobs functionality to send emails. 我配置了“队列/作业”功能来发送电子邮件。

SMTP settings 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

dispatching Job Code 分派工作代码

$job    =   new SendReportEmail($job_data);
$this->dispatch($job);

mail sending code 邮件发送码

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);

        });
    }
}

When I run this command to execute Queued jobs 当我运行此命令以执行排队作业时

php artisan queue:listen --timeout=300

Process is starts, and sometimes I got below error, so due to error and queued again and again attempts, I got same email multiple times. 进程开始了,有时我遇到错误,因此由于错误并一次又一次地排队等待,我多次收到相同的电子邮件。

 Processed: Illuminate\\Queue\\CallQueuedHandler@call [Swift_TransportException] Connection to tcp://smtp.office365.com:587 Timed Out 

What and Where can be the issue? 问题何在何处?

在服务器上尝试ping smtp

telnet smtp.office365.com 587

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM