Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.autosend.com/llms.txt

Use this file to discover all available pages before exploring further.

AutoSend x Auth0
If SMTP isn’t working for your Auth0 tenant, or you’d rather call the AutoSend API directly, you can configure Auth0’s Custom Email Provider Action to send authentication emails through the AutoSend Send Mail API.

Prerequisites

Verified Domain

Make sure you have a verified domain added in AutoSend to send emails from.

API Key

Create a new API key for the Custom Action or use an existing one.

Configuration

2

Enable Custom Email Provider

Toggle Use my own email provider to enable the custom provider configuration.
Enable Custom Email Provider
3

Select Custom Action Provider

Select Custom Provider as your email provider type. Auth0 will create a Custom Email Provider Action that runs every time an authentication email needs to be sent.
Select Custom Provider
4

Add the AutoSend Action Code

Replace the default action code with the snippet below. It forwards every Auth0 notification to the AutoSend Send Mail API.
Auth0 Custom Email Provider Action
exports.onExecuteCustomEmailProvider = async (event, api) => {
  const { notification } = event;
  try {
    const response = await fetch('https://api.autosend.com/v1/mails/send', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${event.secrets.AUTOSEND_API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        from: {
          name: 'AutoSend',
          email: notification.from || '[email protected]',
        },
        to: { email: notification.to || event.user.email || '[email protected]' },
        subject: notification.subject,
        html: notification.html,
        text: notification.text
      })
    });

    if (!response.ok) {
      const error = await response.text();
      api.notification.drop(`Send failed: ${error}`);
      return;
    }
  } catch (error) {
    console.error(`Error sending email: ${error.message}`);
    api.notification.drop(`An unexpected error occurred. Error: ${error.message}`);
  }
};
Update the from.email to an address on your verified domain as a falls back to notification.from value which is sent by Auth0.
You’ll need an AutoSend API key for the next step. Create one from the API Keys page in your dashboard, or follow the API reference for details on authentication.
5

Add the AutoSend API Key as a Secret

In the Action editor, you can click the key icon to add secrets on the left panel and add a new secret named AUTOSEND_API_KEY with your AutoSend API key (AS_xxx) as the value. The action reads it via event.secrets.AUTOSEND_API_KEY.
Add AutoSend API key secret
Never paste the API key directly into the action code. Secrets keep the key out of the action source and out of execution logs.
6

Deploy the Action

Click Deploy/Save in the top right of the Action editor to publish your changes. Auth0 will start routing authentication emails through the action immediately.
7

Send a Test Email

After saving, click the Send Test Email button next to the Save button to send a test email and verify your configuration is working.The test email is delivered to the address in the last field of the to json object '[email protected]'. The other fields (notification.from, notification.subject, etc.) are populated by Auth0 with sample values; only the recipient address controls where the message lands.You can also check the Email Activity dashboard to verify the email was sent through AutoSend.
Send a test email

Viewing Logs

Auth0 captures every Custom Action execution, which is the fastest way to debug send failures. Go to Dashboard > Monitoring > Logs to view log events for your tenant. See Auth0’s View Log Events guide for filtering options. For the Custom Email Provider Action specifically, you can also inspect per-invocation output (including console.error and any api.notification.drop reasons) from the action editor under ActionsLibrary → your action → Logs tab.

Email Templates

Auth0 still owns the email content when you use a Custom Action - the action only delivers what Auth0 hands you in notification.subject, notification.html, and notification.text. To customize the content, edit the templates under BrandingEmail Templates:
  • Verification Email - Sent when users need to verify their email address
  • Welcome Email - Sent after successful signup
  • Change Password - Sent for password reset requests
  • Blocked Account - Sent when an account is blocked
  • Passwordless Email - Sent for passwordless authentication (magic links/codes)
Auth0 email templates use Liquid syntax for dynamic content. Variables like {{ user.email }} and {{ url }} are replaced with actual values before the rendered HTML reaches your action.

Troubleshooting

AutoSend rejects sends from unverified domains. Update the from.email in the action to an address on a domain you’ve verified in Domain Settings.
The AUTOSEND_API_KEY secret is missing, misspelled, or revoked. Re-check the secret name in the action and confirm the key is active in your API Keys dashboard.
  1. Check the action Logs tab for Send failed entries.
  2. Look up the recipient in the Email Activity dashboard.
  3. Confirm the address isn’t in Suppressions.
Only the last field of Auth0’s test form controls the recipient. The other fields are sample values used to populate notification.* and don’t change where the message is sent.

Next Steps

https://mintcdn.com/autosend-13920f5c/nx_wYfWx3qeZwg1C/icons/domain.svg?fit=max&auto=format&n=nx_wYfWx3qeZwg1C&q=85&s=9393f9f9b0f7029e6ba8acf2bc09d864

Verify Your Domain

Set up SPF, DKIM, and DMARC for better deliverability
https://mintcdn.com/autosend-13920f5c/nx_wYfWx3qeZwg1C/icons/email-activity.svg?fit=max&auto=format&n=nx_wYfWx3qeZwg1C&q=85&s=2ecad7369f217ee7d03c3d8dfdd36d22

Email Activity

Monitor your email delivery and engagement
https://mintcdn.com/autosend-13920f5c/nx_wYfWx3qeZwg1C/icons/webhook.svg?fit=max&auto=format&n=nx_wYfWx3qeZwg1C&q=85&s=14ad6675c71731ac04f786559a813ee1

Webhooks

Set up webhooks to track email events in real-time
https://mintcdn.com/autosend-13920f5c/nx_wYfWx3qeZwg1C/icons/smtp.svg?fit=max&auto=format&n=nx_wYfWx3qeZwg1C&q=85&s=d1993edda392d54c3f704a9a4bb04442

Send Mail API

Reference for the AutoSend Send Mail endpoint used by the action