Enum SmtpTransportSecurity
How SmtpAppender secures its connection to the SMTP server.
public enum SmtpTransportSecurity
Fields
ImplicitTls = 2The session is encrypted before the SMTP greeting, without
STARTTLS.Use this for a server that expects implicit TLS on a port other than 465, which Required would try to negotiate with
STARTTLSinstead.None = 0The connection is not encrypted.
Required = 1Transport security is required, and the mechanism follows the port: implicit TLS on port 465,
STARTTLSon every other port.Connecting fails when the server does not offer transport security, rather than continuing unencrypted. This is what EnableSsl selects and is the right choice unless the server does something unusual.
StartTls = 3STARTTLSis required, whatever the port.StartTlsWhenAvailable = 4STARTTLSis used when the server advertises it, and the connection continues unencrypted when it does not.This is opportunistic: an attacker who can modify the traffic can remove the server's
STARTTLSadvertisement and the session then proceeds in plaintext, exposing the credentials and the log content. Only choose it for a network where that is acceptable.
Remarks
This mirrors the transport security modes of the underlying mail library without exposing its types, so that the appender's configuration surface stays CLS compliant.