I am using Microsoft outlook SMTP
details for sending emails from my website to other users.
I configured Queue/Jobs functionality to send emails.
SMTP settings
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.