The disk setup in my .env file is as follows
MAIL_DRIVER=sendmail MAIL_HOST=gmail-smtp-msa.l.google.com MAIL_PORT=587 MAIL_USERNAME=abc@abc.com MAIL_PASSWORD=password MAIL_ENCRYPTION=ssl
and in my config / mail.php my configurations
<?php return [ 'driver' => env('MAIL_DRIVER', 'sendmail'), 'host' => env('MAIL_HOST', 'gmail-smtp-msa.l.google.com'), 'port' => env('MAIL_PORT', 587), 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', ' ract541@gmail.com '), 'name' => env('MAIL_FROM_NAME', 'Tressly'), ], 'encryption' => env('MAIL_ENCRYPTION', 'ssl'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false, 'mailgun' => [ 'domain' => 'your-mailgun-domain', 'secret' => 'your-mailgun-key', ], 'markdown' => [ 'theme' => 'default', 'paths' => [ resource_path('views/vendor/mail'), ], ], ];
I use the following function to send email
Mail::send('Mail.mail', ['msg' => 'Congratulations!!! Your first email template sent'], function($message ) use ($id) { $user = User::getEmail($id); $var = $user->email; $var1 = $user->first_name; $message->to($var, $var1)->subject('User has been approved'); });
after calling this function I get the following error
Expected response code 220 but got code "", with message ""
I tried many solutions from stackoverflow as well as from other sites, but nothing worked in this case. Any ideas?