Using Google SMTP with Supabase Custom SMTP

Last edited: 1/17/2025

Hey everyone, i've been hearing feedback about how challenging it can be to get google SMTP working properly with Supabase. I've tried setting this up with a trial google workspace account and this is what i've discovered.

  1. The sender email and SMTP username has to be your google workspace admin email.
  2. The SMTP password used has to be an app password. Google workspace doesn't make it easy to to figure out how to create this. You need to enable 2FA on your workspace account first (not inside the admin console but in https://myaccount.google.com/)
  3. If you want to use smtp-relay.gmail.com only port 465 works. If you want to use smtp.gmail.com, you can use port 465 or 587 (both ports worked for me).

I'm also gonna include some screenshots below on what those steps look like:

For smtp-relay.gmail.com

image

(The "Require TLS encryption" option doesn't seem to affect anything during my testing) image

For smtp.gmail.com

image

A lot of this was figured out through trial and error - i don't have explanations as to why only port 465 works with smtp-relay.gmail.com and / or why the TLS encryption option has no effect on SMTP.

As to whether this is a Supabase Auth bug, i highly doubt that it is because we use the native golang smtp library . If anyone still has issues getting google SMTP to work, i would recommend to switch to one of these SMTP providers: