Laravel 使用 queue() 发送邮件在服务器上不起作用

bha*_*rat 4 php email laravel laravel-mail

我尝试使用 Laravel 队列作业和 Hostmonster Web 服务器上的网站发送邮件,但当我触发时它不会发送邮件php artisan queue:work,它会清除作业表,但不会清除收到到我的电子邮件地址的邮件。

这是我的排队和发送邮件功能的代码:

    //It is working
    $to = '****@g***l.com';
    \Mail::to($to)->send(new ContactUsMail($contactUsId));

    //It is not working: on same host email working not work with hotmail - gmail - other
    $to = '****@g***l.com';
    \Mail::to($to)->queue(new ContactUsMail($contactUsId));
Run Code Online (Sandbox Code Playgroud)

邮件发送工作正常,有两种情况:

  1. 如果我使用send()方法发送邮件(绕过/忽略队列)
  2. 也使用queue()发送到同一托管电子邮件(如info@myhost.com

但现在如果我使用xyz@yahoo.com/xyz@gmail.com那么在这种情况下队列不起作用 - 作业表也会删除发送邮件时的条目,但宾果..!! 邮件发到哪里我不知道。

另外 cron mail 与队列简单mail()功能相同的问题在那里工作但Mail::send()在那里不起作用..!

bha*_*rat 5

经过多次尝试,我找到了我的服务器的解决方案,其设置工作正常:

.env文件设置MAIL_DRIVER=sendmail.

config/mail.php文件'sendmail' => '/usr/sbin/sendmail -t'替换-bs-t.