Pulses to Gmail

@flamber

I’ve enabled 2FA on my Google account.
I didn’t understand what did you mean by: “use the same credentials with another mail client” ?

@Michael1 Simply try to use the exact same configurations in another email client (Outlook, Thunderbird, Mail.app, etc). I’ve just tried to setup a Gmail account with 2FA on Metabase and it works.

Though I noticed that the password displayed on App Password is split into segments and when you copy it, it might have spaces before/after too, so make sure that the password does not have any spaces anywhere, when inputting it into Metabase.

@flamber

Hi again ,

tried what you’ve suggested (checked that the password was copied correctly, configured gmail on another app), but it didn’t work on metabase

@Michael1
Do you see any other errors/warning at the same time in the log? Admin > Troubleshooting > Logs
Remember that you need to configure SMTP on the other mail client, since many clients are now smart, so they’ll do a lot of magic for you, when setting up a Gmail account.

@flamber

No, no other errors / warnings, and I prefer working with the Gmail client and not the other email clients. I configured one just to check the App password.
As I wrote i followed the instruction and read few posts related and yet can’t configure metabase to send pulses to Gmail

@Michael1 Okay, I’m not sure why it isn’t working for you.

I just setup a new system and did the full configuration.

  1. Metabase > Admin > Settings > Email
    • SMTP Host: smtp.gmail.com
    • SMTP Port: 587 (input the numbers)
    • SMTP Security: TLS
    • SMTP Username: your email address - example@gmail.com or you@example.com if it is a G-Suite account
    • SMTP Password: 16-character App Password, without any spaces before/between/after, generated via https://myaccount.google.com/apppasswords (select Other/custom and call it “Metabase”), and make sure you’re setting it up for the correct account if you’re using multiple Google accounts.
    • From Address: same as “SMTP Username”
  2. Save changes, and click “Send test mail”

Two things that mess up the process:

  • Too clever password managers in the browser that replaces the App Password with something else, when you’re inputting the other information.
  • Firewall/antivirus that is too aggressive, so they’re blocking or intercepting the connection. See this topic for more about that: Using regular gmail as email sender

@flamber

These are exactly the steps I did.
I even copied the 16-char password to another place, removed the spaces and then paste it into the relevant field.
I’ve read the topic you mentioned in your answer before I posted here.
I really appreciate all those advices, but I’m just repeating the same things that others already tried and failed.
Do you know if someone from metabase also present on the discussion page? Maybe they can offer an explanation?

Thanks

@Michael1 I am from Metabase :wink:
If Metabase didn’t work with Gmail SMTP, then there would have been a lot of reports.
Please go to Admin > Settings > Email > click Clear button in the bottom to remove the configuration and start over. Also remove the App Password and generate a new one.
And then check the log for any warnings/errors. Admin > Troubleshooting > Logs

@flamber
My apologies
It seems at first as if this an “experts forum” or “community forum”, I didn’t realize you are from metabase.
I did as you suggested and tried to set the all process from the beginning and unfortunately got the same result.

@Michael1
No worries. It is a community forum, but it’s also a good place for troubleshooting.
Can you do everything again, and post the entire log from Metabase startup until “Send test mail” generates the error?

@flamber

Added the log below.
I didn’t tested the “sent email” because the configuration itself failed.

[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:05:04+02:00 DEBUG metabase.middleware.log GET /api/util/bug_report_details 200 3.5 ms (1 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (82 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:31+02:00 DEBUG metabase.middleware.log GET /api/session/properties 200 2.5 ms (1 DB calls) Jetty threads: 4/50 (3 idle, 0 queued) (84 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:31+02:00 DEBUG metabase.middleware.log GET /api/user/current 200 5.3 ms (3 DB calls) Jetty threads: 4/50 (3 idle, 0 queued) (84 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:31+02:00 DEBUG metabase.middleware.log GET /api/user/current 200 3.6 ms (3 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:31+02:00 DEBUG metabase.middleware.log GET /api/database 200 4.7 ms (3 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:32+02:00 DEBUG metabase.middleware.log GET /api/collection/root/items 200 8.7 ms (7 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:32+02:00 DEBUG metabase.middleware.log GET /api/setting 200 541.6 µs (0 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:32+02:00 DEBUG metabase.middleware.log GET /api/collection/root 200 3.2 ms (2 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:32+02:00 DEBUG metabase.middleware.log GET /api/database 200 4.7 ms (3 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:32+02:00 DEBUG metabase.middleware.log GET /api/automagic-dashboards/database/4/candidates 200 11.5 ms (6 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:37+02:00 DEBUG metabase.middleware.log GET /api/session/properties 200 2.5 ms (1 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:37+02:00 DEBUG metabase.middleware.log GET /api/setup/admin_checklist 200 13.9 ms (11 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:06:37+02:00 DEBUG metabase.middleware.log GET /api/setting 200 456.8 µs (0 DB calls) Jetty threads: 3/50 (4 idle, 0 queued) (85 total active threads) Queries in flight: 0
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:08:29+02:00 ERROR metabase.email Error testing SMTP connection
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:08:29+02:00 ERROR metabase.email Error testing SMTP connection
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:08:30+02:00 ERROR metabase.email Error testing SMTP connection
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:08:30+02:00 ERROR metabase.email Error testing SMTP connection
[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:08:31+02:00 WARN metabase.api.email Problem connecting to mail server: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials t1sm6549069wma.43 - gsmtp

[e0126da4-c1b6-4e1d-bb18-b7cbc04e000b] 2020-02-27T09:08:31+02:00 ERROR metabase.middleware.log PUT /api/email 500 2.4 s (0 DB calls)
{:message “No matching clause: 535-5.7.8 Username and Password not accepted. Learn more at\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials t1sm6549069wma.43 - gsmtp\n”,
:type java.lang.IllegalArgumentException,
:stacktrace
("–> api.email$humanize_error_messages.invokeStatic(email.clj:35)"
“api.email$humanize_error_messages.invoke(email.clj:26)”
“api.email$fn__54122.invokeStatic(email.clj:95)”
“api.email$fn__54122.invoke(email.clj:70)”
“middleware.auth$enforce_authentication$fn__66187.invoke(auth.clj:14)”
“routes$fn__67541$fn__67542.doInvoke(routes.clj:56)”
“middleware.exceptions$catch_uncaught_exceptions$fn__66286.invoke(exceptions.clj:97)”
“middleware.exceptions$catch_api_exceptions$fn__66283.invoke(exceptions.clj:85)”
“middleware.log$log_api_call$fn__67917$fn__67918.invoke(log.clj:178)”
“middleware.log$log_api_call$fn__67917.invoke(log.clj:172)”
“middleware.security$add_security_headers$fn__66249.invoke(security.clj:121)”
“middleware.json$wrap_json_body$fn__67622.invoke(json.clj:64)”
“middleware.json$wrap_streamed_json_response$fn__67640.invoke(json.clj:100)”
“middleware.misc$maybe_set_site_url$fn__67946.invoke(misc.clj:58)”
“middleware.session$bind_current_user$fn__62772$fn__62773.invoke(session.clj:209)”
“middleware.session$do_with_current_user.invokeStatic(session.clj:184)”
“middleware.session$do_with_current_user.invoke(session.clj:177)”
“middleware.session$bind_current_user$fn__62772.invoke(session.clj:208)”
“middleware.session$wrap_current_user_id$fn__62757.invoke(session.clj:161)”
“middleware.session$wrap_session_id$fn__62701.invoke(session.clj:125)”
“middleware.auth$wrap_api_key$fn__66195.invoke(auth.clj:27)”
“middleware.misc$bind_user_locale$fn__67949.invoke(misc.clj:74)”
“middleware.misc$add_content_type$fn__67932.invoke(misc.clj:29)”
“middleware.misc$disable_streaming_buffering$fn__67957.invoke(misc.clj:89)”)}

@Michael1 I don’t know what’s going on. Try setting up an App Password on your private Gmail and try with that.

I am having the same issue. 2FA on and new App Passowrd generated. Same error.

I am using GSuite with my company email

@kilian Can you try from your private Gmail? So far, only two people have reported this, so I think it has something to do with the G-Suite settings. I cannot reproduce on two G-Suite domains and one Gmail.

  • Double check in Gmail that IMAP is enabled

  • Set up AppPasswords

  • Use TLS connection with port 587

  • Open ports on firewall

These should work.

@jins_incent IMAP is not required. Metabase only uses SMTP, it does not read emails. I have IMAP and POP3 disabled.

Yeah I know that IMAP isn’t required, however I have the same issue when I disable IMAP with gmail. But for some reason when I enable it SMTP works too

I was having the same issue. I tried a bunch of options and here's what I found:

The issue is related to how accounts can have "Less Secure Apps" permissions. At the @gmail level, if you turn on 2FA, you cannot have Less Secure Apps on as well. You also cannot have an app password without 2FA on. It won't allow both. So if you have 2FA on, you can use an App Password. If you don't, and you have Less Secure Apps on, you can use your normal login password.

At the @mydomain level, using Google G Suite, it's a little different. You can have 2FA on and Less Secure Apps on, since there is a permission in Security in the Google Admin console that allows individual users to turn this on or off. However, you need 2FA on to also have Less Secure Apps on. If you have both of those, you can use an App Password to send the test email.

It seems like Google wants to fully deprecate Less Secure Apps. Is there any plans to build in the necessary security stuff to avoid needing this soon-to-be deprecated option to be on?

@timabe

I have 2FA=enabled and LSA=disabled on all my Gmail or G-Suite domains, and I don’t have any problems sending mails through Metabase with App Password, so I think there must be some other setting involved for those who are still having problems.

Google might extend the life of LSA a bit longer now, but it will eventually be removed.
Metabase cannot see if what type you’re using in your Google account - Metabase just uses the SMTP configuration (host, port, security, username and password) similar to any other SMTP server.

Would you mind checking your G-Suite LSA settings? They are different from the LSA settings in your user’s google security settings. You can find them at https://admin.google.com/u/1/ac/security/lsa?hl=en.

When the Disable radio button is checked, I get an error when I try to send the test email. If I switch it to “Allow users to manage their access to less secure apps”, I can send the test email. This is despite there being no changes to my users’ LSA settings.