Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Return

Send email using WeWeb

Use the backend `Send Email` action in an API Endpoint or Event Trigger to send emails from your app.

TEMPLATE AVAILABLE

If you wish to skip the manual setup, there is a workflow template available called Send Notification Email. You can find it inside the templates available when creating an API workflow.

Steps at a glance ​

  1. Create an API Endpoint or open the Event Trigger that should send the email.
  2. Configure the backend Send Email action.
  3. Call the API from the Interface, or let the Event Trigger run automatically.
  4. Test it.

1) Create the workflow ​

Choose the setup that matches your use case:

  • For a custom email flow, open Data & API → API Endpoints and create a new endpoint.
  • For auth emails, open Data & API → Workflows → Event triggers, then open the matching trigger such as On email verification requested or On password reset requested.

2) Configure the email action ​

Inside the API Endpoint or Event Trigger:

  1. Add the backend Send Email action if you did not start from the template.
  2. Set the recipient, subject, and content.
  3. Choose whether you want text content, HTML content, or both.
  4. If you are in an API Endpoint, return a success response so your interface can react when the email is sent.

3) Call the workflow ​

If you created an API Endpoint:

  1. In the Interface, add a button or form submit workflow.
  2. Call your email API endpoint.
  3. Pass the values it needs, such as:
    • Recipient email
    • Subject
    • Message

If you used an Event Trigger:

  1. Run the related auth action from the Interface, such as Send verify email, Request password reset, Request magic link, or OTP - Request code.
  2. WeWeb automatically fires the matching Event Trigger.
  3. The Event Trigger sends the email using the values it receives, such as user.email, email, url, or otp.

4) Test it ​

  1. Run the interface workflow in preview.
  2. Confirm the API succeeds.
  3. Confirm the email arrives.

Use this for auth emails ​

The built-in Send Email action is now the default option for auth emails in WeWeb.

Email verification ​

  • Trigger: On email verification requested
  • Recipient: user.email
  • Main value to include: url
  • Example subject: Verify your email

Password reset ​

  • Trigger: On password reset requested
  • Recipient: user.email
  • Main value to include: url
  • Example subject: Reset your password
  • Trigger: On magic link requested
  • Recipient: email
  • Main value to include: url
  • Example subject: Your magic link

OTP ​

  • Trigger: On OTP requested
  • Recipient: email
  • Main value to include: otp
  • Example subject: Your verification code

Simple auth email examples ​

Email verification:

html
<p>Hi,</p>
<p>Confirm your email address by clicking the link below:</p>
<p><a href="{{url}}">Verify email</a></p>

Password reset:

html
<p>Hi,</p>
<p>Click the link below to reset your password:</p>
<p><a href="{{url}}">Reset password</a></p>

Magic link:

html
<p>Hi,</p>
<p>Click the link below to sign in:</p>
<p><a href="{{url}}">Sign in</a></p>

OTP:

html
<p>Hi,</p>
<p>Your verification code is <strong>{{otp}}</strong>.</p>

Common pitfalls ​

The email sends from the wrong flow ​

  • Use the backend Send Email action inside an API Endpoint or Event Trigger.
  • Do not use the old WeWeb Email plugin for this guide.

The email does not arrive ​

  • Check the API response first.
  • If this is an auth flow, check the matching Event Trigger run.
  • Then check the recipient address and spam folder.