public void sendMail()
{
try
{
System.Web.Mail.MailMessage myMail=new MailMessage();
myMail.From = "eym@eym.com.cn";
myMail.To = "superpopredboy@163.com";
myMail.Subject = "MailTest";
myMail.Priority = MailPriority.Low;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "Test";
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//登陆名
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "eym@eym.com.cn");
//登陆密码
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "111111");
SmtpMail.SmtpServer="mail.eym.com.cn"; //your smtp server here
SmtpMail.Send(myMail);
}
catch(Exception e)
{
throw e;
}
}
//-----------------------------------------------------------------------------------------
MailMessage MailMessage = new MailMessage(FromMail, to, subject, body);
MailMessage.IsBodyHtml = true;
SmtpClient SmtpServer = new SmtpClient("XXXX");
SmtpServer.Send(MailMessage);