Adeel Tahir
Adeel Tahir

Reputation: 203

Laravel mailtrap not working on localhost

I have a Laravel 7.0 project, when I try to send email to mailtrap it gives me following error.

Swift_TransportException Unsupported sendmail command flags []. Must be one of "-bs" or "-t" but can include additional flags.

I have following in my .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=MY_USERNAME
MAIL_PASSWORD=MY_PASSWORD
[email protected]
MAIL_FROM_NAME=Example
MAIL_ENCRYPTION=tls

Also tried to clear config cache, but it does not work.

php artisan config:cache

Upvotes: 2

Views: 8361

Answers (3)

Sabin Chacko
Sabin Chacko

Reputation: 761

In my case

php artisan config:clear

Solved the issue.

Upvotes: 2

Jon
Jon

Reputation: 2377

Be sure to restart your queue and run work again:

php artisan queue:restart

php artisan queue:work

From the docs: Since queue workers are long-lived processes, they will not notice changes to your code without being restarted. So, the simplest way to deploy an application using queue workers is to restart the workers during your deployment process.

Upvotes: 7

Rupendra Singh Negi
Rupendra Singh Negi

Reputation: 11

I have same problem, try this if you are using gmail, also add MAIL_FROM_ADDRESS

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=********@gmail.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=*********gmail.com
MAIL_FROM_NAME="${APP_NAME}"

Upvotes: 1

Related Questions