I'm trying to send email in laravel and got this error:
Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
I found some same question in here: Trying to get Laravel 5 email to work But i can't find out where am i wrong.
Here is my mail.php:
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => "tranthanh1500@gmail.com", 'name' => "Test"],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('tranthanh1500'),
'password' => env('tuan@321'),
'sendmail' => '/usr/sbin/sendmail -bs',
];
and here is my .env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=tranthanh1500
MAIL_PASSWORD=tuan@321
MAIL_ENCRYPTION=tls
and here is my code to send email:
<?php
namespace App\Http\Controllers;
use Mail;
use Illuminate\Http\Request;
use App\Http\Requests;
class Test extends Controller {
public function Index() {
Mail::send('test', [], function ($message) {
$message->to('walkingtohorizonvp@gmail.com', 'HisName')->subject('Welcome!');
});
}
}
I has try clear cache, add @gmail.com after username but i still got same error. :(
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/21x7JUN
via IFTTT
Aucun commentaire:
Enregistrer un commentaire