Provides properties and methods for sending messages using the SMTP protocol.
For a list of all members of this type, see Smtp Members.
System.Object
MailBee.InternalUse.LengthyTaskEventSink
MailBee.InternalUse.SocketEventSink
MailBee.InternalUse.SessionProtocolEventSink
MailBee.InternalUse.SmtpEventSink
MailBee.SmtpMail.Smtp
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
You can perform the following operations using this class:
This sample sends plain-text message to the SMTP server. We also disable ESMTP CHUNKING here (it improves sending performance but some servers support it incorrectly, so you may try both methods, with CHUNKING on and off).
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.SmtpMail; // The actual code (put it into a method of your class). Smtp mailer = new Smtp(); // Set the message fields. mailer.From.AsString = "John Doe <jdoe@domain1.com>"; mailer.To.AsString = "Bill Smith <b.smith@domain2.com>"; mailer.Subject = "Weekly newsletter"; mailer.BodyPlainText = "This is the newsletter contents"; // Specify the server to use. If your server does not require authentication, // just remove last 2 parameters. mailer.SmtpServers.Add("smtp.domain1.com", "jdoe", "secret"); // Disable ESMTP CHUNKING even if the server claims CHUNKING is supported // (often helps with MS Exchange servers). mailer.SmtpServers[0].SmtpOptions = ExtendedSmtpOptions.NoChunking; // Send the message. mailer.Send(); Console.WriteLine("The message was successfully submitted to the server.");
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.SmtpMail ' The actual code (put it into a method of your class). Dim mailer As New Smtp ' Set the message fields. mailer.From.AsString = "John Doe <jdoe@domain1.com>" mailer.To.AsString = "Bill Smith <b.smith@domain2.com>" mailer.Subject = "Weekly newsletter" mailer.BodyPlainText = "This is the newsletter contents" ' Specify the server to use. If your server does not require authentication, ' just remove last 2 parameters. mailer.SmtpServers.Add("smtp.domain1.com", "jdoe", "secret") ' Disable ESMTP CHUNKING even if the server claims CHUNKING is supported ' (often helps with MS Exchange servers). mailer.SmtpServers(0).SmtpOptions = ExtendedSmtpOptions.NoChunking ' Send the message. mailer.Send() Console.WriteLine("The message was successfully submitted to the server.")
Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll)
Smtp Members | MailBee.SmtpMail Namespace