Rebex SMTP

SMTP, MIME, S/MIME libraries for .NET

Download 30-day free trial Buy from $99
More .NET libraries

Back to feature list...

Easy-to-use API

On this page:

A typical SMTP session goes through the following steps:

Sending email using SMTP 

The following code sends a simple mail message:

string sender = "my_account@gmail.com";
string recipient = "to@example.org";
string subject = "Test";
string body = "Hello World!";

// create SMTP client instance
using (var smtp = new Rebex.Net.Smtp())
{
    // connect to Gmail SMTP server
    smtp.Connect(gmail_smtp_hostname, SslMode.Explicit);

    // authenticate with your email address and password
    smtp.Login(sender, password);

    // send mail
    smtp.Send(sender, recipient, subject, body);

    // disconnect (not required, but polite)
    smtp.Disconnect();
}
Dim sender As String = "my_account@gmail.com"
Dim recipient As String = "to@example.org"
Dim subject As String = "Test"
Dim body As String = "Hello World!"

' create SMTP client instance
Using smtp = New Rebex.Net.Smtp()
    ' connect to Gmail SMTP server
    smtp.Connect("smtp.gmail.com", SslMode.Explicit)

    ' authenticate with your email address and password
    smtp.Login(sender, password)

    ' send mail
    smtp.Send(sender, recipient, subject, body)

    ' disconnect (not required, but polite)
    smtp.Disconnect()
End Using

Sending e-mail can be even easier. Check out Sending e-mail with a single line of code.

Back to feature list...