string sHost = "SMTP Server"; //設定SMTP Server
int iPort = 25;
SmtpClient oSMTP = new SmtpClient();
MailMessage oMsg = new MailMessage();
MailAddress oFrom = new MailAddress("發送信箱", "發送者顯式名稱", System.Text.Encoding.UTF8);
MailAddress oTo = new MailAddress("接收信箱", "收信者顯示名稱", System.Text.Encoding.UTF8);
//設定該筆訊息的發送相關資料
oMsg.From = oFrom;
oMsg.To.Add(oTo);
oMsg.Subject = "TEST Send Mail";
oMsg.IsBodyHtml = true;
oMsg.Body = "TEST Send";
//設定SMTP相關資料
oSMTP.Host = sHost;
oSMTP.Port = iPort;
oSMTP.Credentials = new NetworkCredential("帳號", "密碼");
oSMTP.EnableSsl = true;
oSMTP.Send(oMsg);