public static bool Sendmailuse ()
{
String host = "smtp.163.com";//mail server smtp.163.com means NetEase mailbox server
String userName = "[e-mail protected]";//Sender Account
string password = "a96606";//send-side password (password after this client is reset)
SmtpClient client = new SmtpClient ();
Client. Deliverymethod = smtpdeliverymethod.network;//Specify how e-mail is sent
Client. Host = host;//mail server
Client. useDefaultCredentials = true;
Client. Credentials = new System.Net.NetworkCredential (userName, password);//username, password
string strfrom = UserName;
String strto = "[email protected]";
String STRCC = "[email protected]";//CC
String subject = "Order title";//the subject of the message
String BODY = "Order title";//message body Sent
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage ();
Msg. from = new MailAddress (Strfrom, "order");
Msg. To.add (Strto);
Msg. Cc. ADD (STRCC);
Msg. Subject = subject;//message Header
Msg. Body = body;//message content
Msg. bodyencoding = system.text.encoding.utf8;//message content encoding
Msg. isbodyhtml = true;//is an HTML message
Msg. Priority = mailpriority.high;//Message Precedence
Try
{
Client. Send (msg);
return true;
}
catch (System.Net.Mail.SmtpException ex)
{
return false;
}
}
C#smtp e-Mail