Skip to content
Fatih Aydin edited this page Jan 29, 2014 · 1 revision

Mail.MailOptions - SMTP Options

A blueprint for the email you wish to send, it has the following members.

string Username
string Password
string SMTPHost
int SMTPPort 
string To 
string From 
string Subject 
string Body 
bool UseSsl 
bool UseHtml 

Mail.SMTP - Send emails using SMTP

You can use the SMTP class to send emails by specifying the SMTP Options.

var options = new MailOptions
{
    SMTPHost = "smtp.gmail.com",
    SMTPPort = 587,
    UseSsl = true,
    Username = "Username@gmail.com",
    Password = "Password",
    To = "netutilities@example.com",
    From = "Username@gmail.com",
    Subject = ".Net Sugar",
    Body = "Net Utilities"
};
SMTP.Send(options);

Clone this wiki locally