Class MailConnectionFactory
Named connection factory for mail transports (SMTP, IMAP, POP3). Register it in the route
registry and reference it by name from the endpoint URI (connectionFactory=my-mailbox)
so mailbox credentials never have to appear in the URI, and therefore can never reach logs,
telemetry, or the Tsak dashboard. One factory serves all three protocols.
Example:
context.AddToRegistry("corp-mailbox", new MailConnectionFactory
{
Host = "mail.corp.local",
Port = 993,
Security = MailSecurityMode.SslOnConnect,
Username = "svc-reports",
Password = Environment.GetEnvironmentVariable("MAIL_PASSWORD")!
});
// route carries no credentials at all:
r.From("imap://?connectionFactory=corp-mailbox&folder=INBOX")
public sealed class MailConnectionFactory
Inheritance
Properties
AccessToken
OAuth2 access token (used instead of the password when set).
public string AccessToken { get; set; }
ClientCertPassword
Password for the client certificate.
public string ClientCertPassword { get; set; }
ClientCertPath
Path to the client certificate for mutual TLS.
public string ClientCertPath { get; set; }
Security
Transport security mode (Auto, None, SslOnConnect, StartTls…).
public MailSecurityMode Security { get; set; }
TrustAllCertificates
Skip server certificate validation (development only!).
public bool TrustAllCertificates { get; set; }