Laravel某些电子邮件无法在服务器上提供

时间:2018-05-04 10:36:15

标签: laravel email sendgrid

某些电子邮件无法在服务器上发送,当我发送测试邮件时,它运行正常,但当我发送订单详细信息电子邮件或用户帐户详细信息时,它无法正常工作。

这是我的代码:

$fromData = $toData = [];
        $fromData = [
          "subject" => "User Credentials",
          "email" => "admin@gaias.co",
          "username" => "Gaias"
        ];

        $toData = [
          "subject" => "User Credentials",
          "email" => "chengwei@joycular.space",
          "username" => "ycw",
          "password" => "1233",
        ];

        // send email
        Mail::send('mail.userCredentials', $toData, function($message) use ($fromData, $toData) {
          $message->from($fromData["email"], $fromData['username']);
          $message->to($toData["email"], $toData["username"]);
          $message->subject($fromData["subject"]);
        });

这是我在.env中的设置

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=XXX
MAIL_PASSWORD=XXX
MAIL_ENCRYPTION=tls

0 个答案:

没有答案