php - Laravel 5.4 SMTP emails not working -
i using laravel 5.4 , configured gmail smtp details sending emails. below code , return expection error.
email code:
try { mail::raw('text', function ($message) { $message->to('lpkapil@mailinator.com'); }); } catch (\exception $e) { echo "<pre>"; print_r($e->getmessage()); print_r($e->getcode()); echo "</pre>"; die(); }
returned execption message & error code
error message:
expected response code 250 got code "530", message "530 5.7.1 authentication required
error code:
530
gmail smtp details used:
mail_host: smtp.gmail.com mail_port: 587 mail_encryption: tls username: gmail id password: password
please suggest solution.
this easy way send mails using laravel.you can use function on controller. have make blade template file example "emailfile.blade.php" ever details want show on email , pass variables blade using inputs array mentioned below.
$inputs = array( 'name'=> 'your name', 'address' =>'your address', 'company' =>'your company', ); mail::send('emailfile', $inputs, function ($message) { $message->from('sender@gmail.com', 'sender name'); $message->to('reciver@gmail.com',$name=null)->subject('mail subject!'); $message->cc('cc@gmail.com'); });
Comments
Post a Comment