App Logo
Plugins

Email Plugin

The Email Plugin provides transactional email capabilities with support for multiple providers and automatic failover.

Features

  • Multi-Provider Support: Use SMTP or Resend as your email provider
  • Automatic Fallback: Configure a backup provider that activates when the primary fails
  • HTML & Text Support: Send both plain text and HTML email formats
  • Template Ready: Built-in support for Go template rendering (html/text)
  • Runtime Configuration: Update provider settings without restarting

Configuration

Add the email plugin to your TOML configuration:

[plugins.email]
enabled = true
provider = "smtp"           # Options: "smtp", "resend"
fallback_provider = ""      # Optional backup: "smtp" or "resend"
from_address = "noreply@example.com"

You can override from_address using the FROM_ADDRESS environment variable.

Library Mode

To use the plugin programmatically, instantiate it as part of the plugins array when creating a new Authula instance:

emailplugin.New(emailplugintypes.EmailPluginConfig{
  Enabled:          true,
  Provider:         emailplugintypes.ProviderResend,
  FallbackProvider: emailplugintypes.ProviderSMTP,
  FromAddress:      "from@example.com",
})

Environment Variables

Configure your provider credentials via environment variables:

SMTP Provider:

.env
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"

Resend Provider:

.env
RESEND_API_KEY="re_xxxxxxxxxxxx"

Provider Details

SMTP Provider

Connects to any SMTP-compliant server (Gmail, SendGrid, AWS SES, etc.). Uses opportunistic TLS for secure connections and supports SMTP authentication.

Resend Provider

Integrates with Resend email API for simple API-based sending with built-in deliverability optimization.

Fallback Behavior

When a fallback provider is configured, emails are first attempted via the primary provider. If that fails, the plugin automatically tries the fallback provider.

Example configuration with fallback:

[plugins.email]
enabled = true
provider = "resend"         # Primary: Use Resend for deliverability
fallback_provider = "smtp"  # Fallback: Use SMTP if Resend fails
from_address = "noreply@example.com"

On this page