SMTP
Description
SMTP is the simplest way to send transactional email through any standards-compliant mail server (Office365, Gmail with app password, on-prem SMTP, etc.).
Your application code depends on IFlexEmailProvider; the SMTP provider supplies that implementation.
Configuration in DI
Register only the provider.
services.AddFlexSmtpEmailProvider(configuration);appsettings.json
Configuration is read from FlexBase:Providers:Email:Smtp.
{
"FlexBase": {
"Providers": {
"Email": {
"Smtp": {
"Host": "smtp.office365.com",
"Port": 587,
"UseSsl": true,
"UseStartTls": true,
"Username": "[email protected]",
"Password": "<store-in-secrets>",
"DefaultFromEmail": "[email protected]",
"DefaultFromName": "Company",
"MaxRetries": 3,
"Timeout": "00:00:30"
}
}
}
}
}Examples (template-based)
This mirrors the generated PostBus handler shape (you do not register the handler manually).
Provider considerations
Prefer StartTLS on port 587 for most providers.
Use secrets storage for
Password.
Last updated