Laravel 5.1邮件未发送且未报告错误

时间:2016-11-28 06:56:48

标签: php laravel email

以下是我的邮件代码和配置。 我面临的问题是mail()不起作用,但我将输出作为邮件发送(来自代码,假装' => false),没有发送('假装' => true,我也得到" server.INFO:假装邮件发送到:soandso@mail.com"在日志文件中)。可能是问题?相同的代码适用于使用相同提供程序托管的另一个站点(GoDaddy)

$mail= Mail::send($view, $data, function ($message) use ($email, $subject, $data) {

            if (isset($data['senderEmail'])) {

                $message->from($data['senderEmail'], $data['senderFullname']);
            }else{
                $defult=\DB::table('settings')->select('value')->where('option','=','defaultMail')->first();
                $message->from($defult->value, 'mailFrom');
            }
            if (isset($data['attachment'])) {
                $message->attach($data['attachment']);
            }
            $message->to($email)->subject($subject);
        });
        if($mail){
          dd("mail sent");
        }else{
          dd("not sent");
        }

.env文件

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=XXXXXXXX@gmail.com
MAIL_PASSWORD="XXXXXXXX"
MAIL_ENCRYPTION=tls

SENDERS_EMAIL=XXXXXXXX@gmail.com
SENDERS_NAME=afsal

配置/ mail.php

'sendmail'   => '/usr/sbin/sendmail -bs',
 'pretend'    => false,

0 个答案:

没有答案