Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I send emails drirectly to users with laravel?

I have a laravel project, this project has "forgot password" plugin.
But when i send reset link to users mail, this link doesnt go to the user mail’s inbox.
It goes to the my smtp account. I am using mailtrap for testing. I want to be able to send mail directly to user’s email. Is it possible to do that with codes. Or should i forward to emails. And how can i do that ? What am i doing wrong ?

What email address they type in this input, reset link should go that email not my mailtrap account.

My reset email link

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Password reset link comes here. I dont want that. It has to send reset link to user’s email not my mailtrap account.

Email comes here.

Last step should be same but we have to come here from user’s email.

enter image description here

>Solution :

You’re using mailtrap at the moment. This doesn’t send any emails to the real world. To receive an email, you must configure correspondence in your .env file.

Default .env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

ex: for Gmail

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

Check this example – Laravel 9 Send Mail using Gmail SMTP Server and for configurations

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading