MailMessage mm = new MailMessage();
mm.BodyFormat = System.Web.Mail.MailFormat.Html;
mm.From = "这里填写发件人的邮箱 如:(***@163.com)";
mm.Fields.Add("
", "1");
mm.Fields.Add("
", "这里填写发件人的邮箱的账号,@前的内容");
mm.Fields.Add("
", "这里填写发件人邮箱的密码");
mm.To = "这里则是填写收件人的邮箱";
mm.Subject = "这里填写邮件的标题";
mm.Body = "这里填写邮件内容";
System.Web.Mail.SmtpMail.SmtpServer = "smtp.163.com"; //发件服务器名称
try
{
System.Web.Mail.SmtpMail.Send(mm); //发送邮件
}
catch (System.Exception err)
{
Response.Write(err.Message);
}
标签:C#,asp,net