[solved] Laravel 7 Swift_TransportException Cannot send message without a sender address

If you are getting “Swift_TransportException Cannot send message without a sender address” while trying to send email notifications using the mailtrap email testing tool. Then please make sure you added right settings of the mailtrap login details inside the .env file

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=[mailtrap username]
MAIL_PASSWORD=[mailtrap password]
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=your@emailaddress.com
MAIL_FROM_NAME="${APP_NAME}"

Add from email address and encryption. Then you have to clear config using following commands

php artisan config:clear

The config:clear command is used to remove the configuration cache file created by the config:cache command. By default this command will delete the bootstrap/cache/config.php file

If you still get that error then clear cache using

php artisan cache:clear

Leave a Reply

Your email address will not be published. Required fields are marked *