Custom Swoosh adapter for Gmail API using OAuth2 authentication.
This adapter uses the Gmail API v1 with OAuth2 tokens instead of SMTP with app passwords.
Configuration
config :voile, Voile.Mailer,
adapter: Voile.Mailer.GmailApiAdapter,
access_token: System.get_env("VOILE_GMAIL_ACCESS_TOKEN"),
# Optional: for token refresh
refresh_token: System.get_env("VOILE_GMAIL_REFRESH_TOKEN"),
client_id: System.get_env("VOILE_GMAIL_CLIENT_ID"),
client_secret: System.get_env("VOILE_GMAIL_CLIENT_SECRET")Getting Initial Tokens
You can get tokens using the GmailAuth module:
# Get authorization URL
url = Voile.Mailer.GmailAuth.authorization_url()
# After user authorizes, exchange code for tokens
{:ok, tokens} = Voile.Mailer.GmailAuth.get_tokens(code)Store the access_token and refresh_token in your environment variables.
Summary
Functions
Callback implementation for Swoosh.Adapter.validate_config/1.
Callback implementation for Swoosh.Adapter.validate_dependency/0.
Functions
Callback implementation for Swoosh.Adapter.validate_config/1.
Callback implementation for Swoosh.Adapter.validate_dependency/0.