fusionauth-issues icon indicating copy to clipboard operation
fusionauth-issues copied to clipboard

Gmail SMTP does not work

Open dmitri777 opened this issue 3 years ago • 3 comments

Gmail SMTP does not work

Description

Cannot use Gmail (smtp.gmail.com), test emails fail with generic non-informative message, event if Debug is enabled

Affects versions

1.40.2

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to Tenant Settings, Email Section
  2. Enter any valid Gmail smtp configuration that works fine with other SMTP clients like Thunderbird
  3. Try to send test email
  4. See error "Unable to send email via JavaMail / Prime Messaging Exception"

Expected behavior

SMTP configuration must work for such a major service as Google

Platform

(Please complete the following information)

  • Device: Ubuntu 12.12 server with FusionAuth installation at backend / Desktop at client side
  • OS: Ubuntu 12.12 server at backend / Windows 11 Home at client side
  • Chrome Version 106.0.5249.103 (Official Build) (64-bit) at client side
  • psql (PostgreSQL) 12.12 (Ubuntu 12.12-0ubuntu0.20.04.1) at server side

Community guidelines

All issues filed in this repository must abide by the FusionAuth community guidelines.

Additional context

Add any other context about the problem here.

dmitri777 avatar Oct 14 '22 09:10 dmitri777

Thanks for filing this. I was able to replicate. No messages in the event log.

Here's a link for the gmail SMTP setup: https://support.google.com/mail/answer/7126229?hl=en#zippy=%2Cstep-change-smtp-other-settings-in-your-email-client

mooreds avatar Oct 14 '22 14:10 mooreds

Some consumer oriented SMTP servers have a lot of restrictions that may be out of our control.

Can you replicate the results with something like SWAKS to ensure it is something specific to FusionAuth? https://jetmore.org/john/code/swaks/

robotdan avatar Oct 20 '22 07:10 robotdan

Likely related to this fix...based on my past experience this was a Gmail setup configuration issue (but will leave open the possibility that something else is at play here or that possibly our error handler could relay more info).
https://fusionauth.io/community/forum/topic/1112/smtp-server-gmail-setup-error/3?_=1666277007403

jobannon avatar Oct 20 '22 14:10 jobannon

@mooreds , @jobannon

Issue reporter here. Found a way to solve it.

You really need to use 16-char app passwords with Google SMTP, as it is suggested here https://support.google.com/accounts/answer/185833, thanks @jobannon

It works fine then. Maybe it makes sense to add a simple checking to FusionAuth web page, like, if STMP server is "smtp.gmail.com", show alert("Hey, normal passwords do not work with Google, use app password")

dmitri777 avatar Nov 08 '22 12:11 dmitri777

Thank you @dmitri777 for sharing!

mooreds avatar Nov 09 '22 01:11 mooreds

This is probably too implementation specific for our docs or product, but I added a forum post: https://fusionauth.io/community/forum/topic/2233/having-trouble-using-gmail-smtp-for-email-sending

mooreds avatar Nov 09 '22 01:11 mooreds