I have configured my SMTP server correctly in Laravel's env file, and can successfully send an email using Mail::raw e.g.
Mail::raw("This is a test message", function ($message) {
$message->from(env("MAIL_ORDER_ADDRESS"), 'Orders');
$message->to('[email protected]');
$message->subject('Test Message');
});
However, when I use a laravel 5.3 mail notification, no email is received (nor is an error generated). I have tested the same notification code locally using mail trap and the notifications work correctly.
I can't understand how if the mail server is working and can be used with Mail::raw, it doesn't automatically work with notifications when I have tested locally and confirm they are coded correctly.
Hmm... This is strange. I've never had a problem with this before. Though, my emails weren't sending either all the sudden. I never touch the config/mail config file. I use the .env file. But after reading this I said to myself what the hey and tried it. Of course when I modified the from fields to exactly what I have in my .env file, it worked. So my question is why is it not just simply pulling the info from my .env file???
Ha! Never mind. I guess MAIL_FROM_ADDRESS and MAIL_FROM_NAME aren't even in the .env file. Anyway I just put my from email address and from name as alternatives to the .env values as it's not really sensitive information anyway: