简体   繁体   English

无法使用laravel Mail发送邮件

[英]Can not send mail using laravel Mail

i am using Laravel Mail to send mail but it shows 500 error with 我正在使用Laravel Mail发送邮件,但显示500错误

The localhost page isn't working 本地主机页面不起作用

localhost is currently unable to handle this request. 本地主机当前无法处理此请求。

i am using this code 我正在使用此代码

\Mail::send('suppliers.mail',['name' => 'test'],function ($mail) {

   $mail->subject('Supplier Details');
   $mail->from('dump.test@gmail.com');
   $mail->to('dump.ajit@gmail.com');
});

i have already setup smtp server in ubuntu and configure mail.php in config folder of laravel, i can send mails using core php code 我已经在ubuntu中设置了smtp服务器并在laravel的config文件夹中配置了mail.php,我可以使用核心php代码发送邮件

In .env file 在.env文件中

  • MAIL_DRIVER=mail
  • MAIL_HOST=localhost
  • MAIL_PORT=587

Mail Function It's Working. 邮件功能正在运行。

$a = Mail::send('emails.reminder', [], function ($m) {
    $m->from('no-reply@domain.com');
    $m->to('vijaydeva@domain.com')->subject('Your Reminder!');
});

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

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