Smtp Client Constructor
Initializes a new instance of the SmtpClient class.
Definition
Remarks
Before you can send messages with the SmtpClient, you must first call one of
the Connect methods.
Depending on whether the SMTP server requires authenticating or not, you may also need to
authenticate using one of the
Authenticate methods.
Example
C#
public static void SendMessages (IList<MimeMessage> messages)
{
using (var client = new SmtpClient ()) {
client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
client.Authenticate ("username", "password");
foreach (var message in messages) {
client.Send (message);
}
client.Disconnect (true);
}
}