Smtp |
public override void Disconnect( bool quit, CancellationToken cancellationToken = default )
Exception | Condition |
---|---|
ObjectDisposedException | The SmtpClient has been disposed. |
public static void SendMessage (MimeMessage message) { using (var client = new SmtpClient ()) { client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect); client.Authenticate ("username", "password"); client.Send (message); client.Disconnect (true); } }