Skip to main content

Email Configuration

Flo supports multiple email providers for sending transactional emails (registration confirmations, OTP codes, booking notifications, newsletters).

Supported Providers

Send from your own domain with no verification required.

Setup:

  1. Go to Cloudflare Dashboard > your domain > Email > Email Routing > SMTP Credentials
  2. Create SMTP credentials (username + auto-generated password)

Configuration in .env:

EMAIL_SENDER_EMAIL_PROVIDER=Cloudflare
EMAIL_SENDER_EMAIL_USERNAME=newsletter
EMAIL_SENDER_EMAIL_ALIAS=newsletter@yourdomain.com
EMAIL_SENDER_EMAIL_PSW=your-cloudflare-smtp-password

Provider config in appsettings.json:

{
"Name": "Cloudflare",
"Host": "route3.mx.cloudflare.net",
"Port": 587,
"EnableSsl": false
}

Gmail with Alias

Use Gmail's "Send As" feature to send from a custom domain.

Prerequisites:

  • 2FA enabled on the Gmail account
  • App Password generated (not regular password)
  • Gmail "Send As" alias configured and verified

Configuration in .env:

EMAIL_SENDER_EMAIL_PROVIDER=Gmail
EMAIL_SENDER_EMAIL_USERNAME=info@gmail.com
EMAIL_SENDER_EMAIL_ALIAS=newsletter@yourdomain.com
EMAIL_SENDER_EMAIL_PSW=your-gmail-app-password

Setting up Gmail "Send As":

  1. Gmail Settings > Accounts and Import > "Send mail as" > Add another email address
  2. Enter the alias email, uncheck "Treat as an alias"
  3. Complete email or DNS verification
  4. Optionally set as default sender

Custom SMTP

For other providers (SendGrid, Mailgun, Amazon SES):

EMAIL_SENDER_EMAIL_PROVIDER=Smtp
EMAIL_SENDER_SMTP_HOST=smtp.example.com
EMAIL_SENDER_SMTP_PORT=587
EMAIL_SENDER_EMAIL_USERNAME=your-username
EMAIL_SENDER_EMAIL_ALIAS=sender@yourdomain.com
EMAIL_SENDER_EMAIL_PSW=your-password

Email Templates

Flo uses MJML for responsive email templates. Templates are brand-specific:

  • Header logo changes per brand (Flo vs Respirastudio)
  • Color scheme matches brand theme
  • Customer name from FLO_CUSTOMER_NAME_IT / FLO_CUSTOMER_NAME_EN

Testing

Verify Configuration on VPS

# Check environment variables
sudo docker exec flo env | grep EMAIL

# Restart container after changes
sudo docker restart flo

# Monitor logs for email sending
sudo docker logs -f flo

Expected Email Headers

From: newsletter@yourdomain.com
Reply-To: newsletter@yourdomain.com

Troubleshooting

IssueCauseFix
Emails show Gmail address as senderGmail alias not verifiedComplete "Send As" verification
SMTP authentication failedWrong App Password or 2FA not enabledGenerate new App Password with 2FA
Container ignores new env varsEnv loaded at container startRestart: sudo docker restart flo

Code Reference

FilePurpose
Flo.BE/Services/EmailSender/Core/EmailMessageFactory.csEmail construction with alias support
Flo.BE/Services/EmailSender/EmailSenderService.csSMTP sending logic
compose.yamlDocker environment variable mapping