MailMessage objMail = new MailMessage();
objMail.Subject = "郵件主題";
objMail.Body = "郵件正文";
string mfrom = txtFrom.Value; //從頁面讀取發送者地址
objMail.From = new MailAddress(mfrom);
string mt = txtTo.Value; //從頁面讀取接收者地址
MailAddress ma = new MailAddress(mt);
objMail.To.Add(ma);
objMail.IsBodyHtml = true;//指示郵件為html格式的值
objMail.Priority = MailPriority.High;//設置郵件的優先級
objMail.Attachments.Add(new Attachment("F:\\aba.doc"));//添加附件
SmtpClient smtp = new SmtpClient();
smtp.Host = "……"//smtp事務的IP地址,如smtp.cc.com
smtp.Send(objMail);//發送郵件