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.
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.
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.
But how to know if that work or not? If failures() doesn't return anything then it has been successfully sent.
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.
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 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With