Im trying to Mail in Laravel 5.1
my mail.php code is
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'myemail@gmail.com', 'name' => 'sample'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => env('MAIL_PRETEND', false),
];
my .env file is
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=null
my function to email is
public function sendEmailVerification()
{
$user = $this->user;//retrieved by $request->user() in __construct
Mail::send('emails.verifyemail', ['user' => $user], function ($m) use ($user) {
$m->from('myemail@gmail.com, 'sample');
$m->to($user->email, $user->name)->subject('Verify Email');
});
}
Expected response code 250 but got code "530", with message "530 5.7.0 Must issue a STARTTLS command first. l188sm21749863pfl.28 - gsmtp" error appears every time i call my function.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire