I have a problem on my staging environment while the problem does not occur in my local env.
->from(env('MAIL_FROM_ADDRESS'), "$user->firstname $user->lastname")
it gives me following error;
(1/1) Swift_RfcComplianceException
Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
It seems that app is not able to get the mail_from_address from my .env file. Why is this happening as everything works fine in my local environment?
I have these in my deploy script as well,
composer dump-autoload
# Clear caches
php artisan cache:clear
php artisan auth:clear-resets
php artisan config:clear
php artisan config:cache
php artisan view:clear
What am I missing here? Any suggestion? Is the problem something else?
EDIT 2: I actually hard coded my from address as below and everything worked fine.... So question is how come app is not reading .env file? Is this some type of a cache problem?
->from("email@email.com", "$user->firstname $user->lastname")
Edit 1: 'MAIL_FROM_ADDRESS' exixts in my .env file.
EDIT 3: SOLUTION
I moved config:cache before config:clear in my deploy script and app was able to get the email address from .env file.