Swift_TransportException error in laravel

Swift_TransportException Cannot send a message without a sender address in Laravel

Today, I will give you an example of “How to fix Swift_TransportException Cannot send a message without a sender address in Laravel”. So you can easily apply it with your laravel applications.

Swift_TransportException in Laravel

This is a common error in laravel application, the Swift_TransportException through this error while we send a mail and perform an action in laravel application.

Cannot send a message without a sender address in Laravel

This error is basically seen in our application when we not define the “MAIL_FROM_ADDRESS” in the .env file.

Let’s fix this error

fix Swift_TransportException error in laravel
MAIL_FROM_ADDRESS=contact@gmail.com

Just add a MAIL_FROM_ADDRESS by default it is NULL in .env file.

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=25
MAIL_USERNAME=yourgmailid@gmail.com
MAIL_PASSWORD=yourpassword
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=contact@gmail.com
MAIL_FROM_NAME="${APP_NAME}"

If everything is completed and it still not working, it might be caching issue. You can clear the config cache with this.

php artisan config:cache

In this article, we successfully fixed “Swift_TransportException Cannot send a message without a sender address in Laravel”, I hope this article will help you with your Laravel application Project.

Read also : Send email to multiple users using Queue in Laravel.

Hi, My name is Gaurav Pandey. I'm a Laravel developer, owner of 8Bityard. I live in Uttarakhand - India and I love to write tutorials and tips that can help other developers. I am a big fan of PHP, Javascript, JQuery, Laravel, WordPress. connect@8bityard.com