0
votes

I want to send mail through Illuminate/Support/Facades in laravel 5.4.36 on Ubuntu 16.04 lts set up on Digital Ocean

Controller code:

  \Mail::send('emails.users.UserRegistered', ['user' => $user, 'app_url' => 
    $appUrl, 'token' => $token], function ($m) use ($user) {
                        $m->to($user->email)->subject('New User Registered - 
     SampleApp');
                    });

mail config:

return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
    'port' => env('MAIL_PORT', 587),
    'from' => ['address' => env('MAIL_FROM_EMAIL'), 'name' => env('MAIL_FROM_NAME')],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',

];

However, I am not receiving any email. No errors in storage/logs/laravel.log

No email no errors.

1
which email driver are you using? did you setup correct api key? - Ben
Have you checked the logs on Mailgun to see if they are actually receiving your SMTP requests? - Joe

1 Answers

0
votes

I went a different route with this. I used google SMTP. I generated the app password on the email and used it in the application. This seems to work.