简体   繁体   中英

How to send email in laravel

I have tried this.

<?php
return array(
  'driver' => 'smtp',
  'host' => 'smtp.sendgrid.net',
  'port' => 587,
  'from' => array('address' => 'from@example.com', 'name' => 'John Smith'),
  'encryption' => 'tls',
  'username' => 'sendgrid_username',
  'password' => 'sendgrid_password',
);


Mail::send('emails.demo', $data, function($message)
{
    $message->to('jane@example.com', 'Jane Doe')->subject('This is a demo!');
});

But i am getting this error:

Failed to authenticate on SMTP server with username "sendgrid_username" using 2 possible authenticators

How to resolve this problem.

Please help me.

确保设置正确,用户名和密码正确,该功能本身应如您所发布的那样起作用。

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.

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