Mailer & SMS
Configure SMTP and Twilio so that Spica can send verification codes, magic links, password resets and passwordless logins by email and SMS.
Spica sends email and SMS for the user flows of the Passport module: email and phone verification, password reset and passwordless login. Configure the channels with startup options.
Email (SMTP)
| Option | Description |
|---|---|
--mailer-host | SMTP server, for example smtp.sendgrid.net. |
--mailer-port | SMTP port, for example 587. |
--mailer-secure | Use TLS from the start (port 465). Default false, which still upgrades with STARTTLS when the server offers it. |
--mailer-user, --mailer-pass | SMTP credentials. |
--mailer-from | Default sender, for example "Acme <no-reply@acme.com>". |
--mailer-host=smtp.sendgrid.net --mailer-port=587 \
--mailer-user=apikey --mailer-pass=$SENDGRID_API_KEY \
--mailer-from="Acme <no-reply@acme.com>"SMS (Twilio)
| Option | Environment variable |
|---|---|
--sms-sender-strategy=twilio | |
--twilio-sms-service-account-sid | TWILIO_ACCOUNT_SID |
--twilio-sms-service-auth-token | TWILIO_AUTH_TOKEN |
--twilio-sms-service-from-number | TWILIO_FROM_NUMBER |
Prefer the environment variables for credentials. The Helm chart reads them from application.twilioAccountSid, application.twilioAuthToken and application.twilioFromNumber.
What users receive
| Strategy | SMS | |
|---|---|---|
Otp | Subject Spica verification code, text Your verification code is: 123456 | Your verification code is: 123456 |
MagicLink | Verify your email by clicking this link: <link> | Verify your phone by clicking this link: <link> |
Magic links point to <public-url>/passport/user/verify-magic-link?token=..., so --public-url must be reachable by your users.
Sending other messages
The mailer and SMS sender don't have a public API. To send your own emails or texts, for example order confirmations, call your provider from a function, with its credentials stored as secrets.