Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel is sending mail using my old email configuration

I've changed my e-mail configuration in the .env file but when I'm trying to send a mail, it's using my old configuration.

I've tried some commands:

php artisan clear-compiled, php artisan cache:clear, and php artisan config:clear but it still sending using my old email.

I also tried to change the password of my old Gmail account, but my site is just sending mail with my old mail account.

I've noticed this:

This message may not have been sent by: [redacted]@gmail.com Learn more Report phishing

on the received mail.

like image 367
don_jon Avatar asked Jan 20 '17 09:01

don_jon


People also ask

How do I change my email in Laravel?

Laravel provides from() where we can change email and name of mail. We will change the following code on MyTestMail class as follows and you will see how to change from name and address with output. * Create a new message instance. * Build the message.

What is mailable Laravel?

Laravel provides a clean, simple email API powered by the popular Symfony Mailer component. Laravel and Symfony Mailer provide drivers for sending email via SMTP, Mailgun, Postmark, Amazon SES, and sendmail , allowing you to quickly get started sending mail through a local or cloud based service of your choice.

How do you know Mail is sent or not in Laravel?

But how to know if that work or not? If failures() doesn't return anything then it has been successfully sent.


2 Answers

If you're sending emails from a queue, try restarting the queue using php artisan queue:restart.

This fixed the issue for me. I had tried composer dump-autoload, php artisan clear-compiled, php artisan cache:clear, and php artisan config:clear as mentioned above but they didn't fix the issue in my case.

like image 92
Leighton Kuchel Avatar answered Oct 22 '22 04:10

Leighton Kuchel


When you send email usually you would use some mail library and you get to choose ->from("[email protected]") parameter. This email object then gets sent using an email driver. The email driver then uses the environment settings to connect to an smtp account for e.g.

So changing the environmental variable will change the account which is the actual email sender but I assume you have forgotten to change the ->from("..") parameter.

This explains why you are seeing a notice saying this may not have been sebt by ...

like image 28
Donii Hoho Avatar answered Oct 22 '22 06:10

Donii Hoho