naykel's avatar

Verification emails not working with SMTP

I would like to send user verification emails; I have tested with mail trap and it works fine but when I use my SMTP settings it no longer works.

I have checked my settings and can confirm they are fine if for no other reason than I have other mailables set up that work fine.

I done some further testing using mail gun and can confirm that the verification email was sent.

This problem seems to only occur when sending a verification email using my own SMTP settings.

Any suggestions?

0 likes
12 replies
thamibn's avatar

i would suggest you try this https://www.smtper.net/ to confirm your SMTP details and dont forget to run php artisan config:cache after changing the email details on you .env file

naykel's avatar

I have tested and the SMTP setting are definitaly correct.

Just to clarify, I am able to send emails without any problems using the mailable class, this issue only occurs when sending the verification email after a user registers. The registration is successful are no errors are displayed so it appears to be working fine except there is no email for the user to verify their account.

bugsysha's avatar

You've added implements MustVerifyEmail to User model?

naykel's avatar

Yes. It is important that anyone that reads this is aware that the verification email works fine when using mailtrap and mailgun. The problem ONLY exists when using my own SMTP settings even tho I can use them to send other emails.

This would be so much easier to solve it they all failed but they don't!

bugsysha's avatar

Have you checked spam folder? Are you sure that you are sending all your emails and notifications from the same email address?

When ever I can not see the problem straight away it almost always turns out to be something silly like typo.

chrisgrim's avatar

I am having this issue too when doing it on my server. With maitrap I see that the email is coming form

Example <[email protected]>

How would I change that? Could it be causing it to get caught?

naykel's avatar

I have checked all the obvious things because you are right in saying that it normall turns out to be something silly, however this time round it is not the case. If it were the case the contact form which uses the same credentials would not work either.

I also check with telescope and all the details are correct.

chrisgrim's avatar

I realized mine was getting caught in gmails spam filter because it looked dangerous.

naykel's avatar

I have just tested on my live server and it works fine!!!

This problem seems to be isolated to sending the verify email working on localhost.

bugsysha's avatar

I have just tested on my live server and it works fine!!!

So now it's working?

Please or to participate in this conversation.