Auth0 Ignores Custom SendGrid Headers When Patching the Email Provider
Last Updated:
Overview
When an administrator patches the Auth0 email provider configuration via the Management API to include custom SendGrid headers, Auth0 ignores the headers. This occurs because the native Simple Mail Transfer Protocol (SMTP) provider configuration does not support SendGrid-specific headers. Administrators resolve this by configuring a Custom Email Provider Action to call the SendGrid API directly. Although the Management API returns a 200 OK response, Auth0 does not apply the X-SMTPAPI header to the configuration.
Applies To
- Auth0
- Email Provider
- SendGrid
- Management API
Cause
The settings.headers object for the native SMTP provider type only supports X-SES-Configuration-Set for Amazon Web Services (AWS) SES and X-MSYS_API for SparkPost. Auth0 does not support headers for the SendGrid SMTP relay to control IP pool selection or similar SendGrid-specific features.
Solution
How does an administrator configure a custom email provider for SendGrid?
Configure a Custom Email Provider Action in the Admin Console to call the SendGrid API directly and pass the required IP pool selection.
- Navigate to Branding > Email Provider in the Admin Console.
- Enable Use my own email provider.
- Select the Custom Provider option.
- Write an Action using the
onExecuteCustomEmailProviderhandler to call the SendGrid Mail Send API directly. - Store the SendGrid API key securely as a secret in the Action.
- Pass the IP pool selection as an
ip_pool_namefield in the request body instead of using the legacyX-SMTPAPIheader syntax.