Configure and use the email service in Supabase

Updated at:
Copy as MD

A reliable email notification system is essential for user registration, password resets, and email confirmation. AnalyticDB for PostgreSQL integrates with Supabase Auth to provide enterprise-grade email capabilities. You can use the default Alibaba Cloud email service to get started quickly or connect a custom SMTP server for production use.

Prerequisites

  • Create a Supabase project. Existing AnalyticDB for PostgreSQL Supabase projects must have been created after the following dates:

    • China regions: September 4, 2025.

    • Singapore: August 29, 2025.

    Note

    The supported regions are those displayed on the console. You can log on to the Supabase Dashboard and check if the Authentication > Sign In/Providers menu option appears in the left-side navigation pane. If it does, your region is supported.

  • You have enabled public access for your AnalyticDB for PostgreSQL Supabase project.

Configure an SMTP server

Important

Use a custom SMTP server for production environments. To get started quickly and test the email service, you can use the default SMTP server.

Custom SMTP server

If you use Supabase Auth, you must set up a custom SMTP server to send emails for the following features:

  • Account creation with an email and password.

  • Passwordless accounts (via a one-time password Magic Link).

  • User invitations via email.

  • Social login with email confirmation.

Procedure

  1. Log on to the Supabase Dashboard. In the left-side navigation pane, click Authentication > Emails.

  2. Turn on the Enable Custom SMTP toggle and configure your custom SMTP server.

In the Sender details section, set Sender email to supabase@service.aliyun.com and Sender name to supabase. In the SMTP Provider Settings section, set Host to smtp.aliyun.com, Port number to 465, and Minimum interval between emails being sent to 60 seconds.

image

Default SMTP server

AnalyticDB for PostgreSQL Supabase provides a pre-configured SMTP server that automatically sends invitation and confirmation emails. Use it to quickly test the email service.

The default SMTP server has the following limitations and is not suitable for production environments:

  • Limited email delivery: Due to regional restrictions, some email providers may block emails from the default SMTP server.

  • Strict rate limit: The default SMTP service limits the number of emails that can be sent per project. This limit is subject to change at any time.

  • No SLA guarantee: The default SMTP server does not offer a service availability guarantee and is intended only for exploring Supabase Auth and testing.

Usage

  1. Enable email confirmation.

    1. Log on to the Supabase Dashboard. In the left-side navigation pane, click Authentication > Sign In/Providers.

    2. Click Email, turn on the Confirm email switch, and then save the configuration.

      image.png

  2. Sign up a new user.

    Dashboard

    Log on to the Supabase Dashboard. In the left-side navigation pane, click Authentication > Users. On the right, click Add user, and then select Create new User.

    image

    API

    Log on to the Supabase Dashboard. In the upper-left corner, click Connect. In the dialog box that appears, click App Frameworks to get your SUPABASE_PUBLIC_URL and ANON_KEY. Example call:

    curl -X POST 'http://<SUPABASE_PUBLIC_URL>/auth/v1/signup' \
      -H 'apikey: <YOUR_ANON_KEY>' \
      -H 'Content-Type: application/json' \
      -d '{
        "email": "example@email.com",
        "password": "testPassword"
      }'

    Supabase-js

    For instructions on installing and using supabase-js, see supabase-js.

    const { data, error } = await supabase.auth.signUp(
      {
        email: 'example@email.com',
        password: 'testPassword',
        options: {
          data: {
            first_name: 'John',
            age: 27,
          }
        }
      }
    )