Table of Contents

Enum SmtpTransportSecurity

Namespace
log4net.Ext.Mail.Appender
Assembly
log4net.Ext.Mail.dll

How SmtpAppender secures its connection to the SMTP server.

public enum SmtpTransportSecurity

Fields

ImplicitTls = 2

The 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 STARTTLS instead.

None = 0

The connection is not encrypted.

Required = 1

Transport security is required, and the mechanism follows the port: implicit TLS on port 465, STARTTLS on 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 = 3

STARTTLS is required, whatever the port.

StartTlsWhenAvailable = 4

STARTTLS is 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 STARTTLS advertisement 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.