This is a detailed reference for email-related types in Stack Auth. If you're looking for a more high-level overview, please refer to our guide on the email system.
On this page:
SendEmailOptions
Options for sending emails via the sendEmail
method on StackServerApp
.
Table of Contents
An array of user IDs that will receive the email. All users must exist in your Stack Auth project.
userIds: string[]
{
userIds: ['user-1', 'user-2', 'user-3'],
// ... other options
}
Optional theme ID to apply to the email. Use null
for no theme, false
to use the default theme, or a string ID for a specific theme.
themeId?: string | null | false
{
themeId: 'corporate-theme-id',
// or
themeId: null, // no theme
// or
themeId: false, // default theme
// ... other options
}
Optional email subject line. If using a template, this overrides the template's default subject.
subject?: string
{
subject: 'Welcome to our platform!',
// ... other options
}
Optional notification category name for user preferences. Users can opt in or out of specific categories through their account settings.
notificationCategoryName?: string
{
notificationCategoryName: 'product_updates',
// ... other options
}
Custom HTML content for the email. Use this option when you want to send a custom HTML email instead of using a template. Cannot be used together with templateId
or variables
.
html?: string
{
userIds: ['user-1'],
html: '<h1>Welcome!</h1><p>Thanks for joining us.</p>',
subject: 'Welcome to our platform'
}
ID of the email template to use. Use this option when you want to send a template-based email with variables. Cannot be used together with html
.
templateId?: string
{
userIds: ['user-1'],
templateId: 'welcome-template',
variables: {
userName: 'John Doe',
activationUrl: 'https://app.com/activate/token123'
}
}
Optional variables to substitute in the template. Only used when templateId
is provided.
variables?: Record<string, any>
{
templateId: 'welcome-template',
variables: {
userName: 'John Doe',
activationUrl: 'https://app.com/activate/token123',
supportEmail: 'support@yourapp.com'
}
}