using System;
using System.Web.Mail;
namespace smail
{
/// <summary>
/// mail 的摘要说明。
/// </summary>
public class mail
{
public mail()
{
}
public void Post(string Title,string Smail,string Body)
{
/// <summary>
/// Title 邮件标题,Smail 收件人,Body 邮件内容
/// </summary>
MailMessage mailobj = new MailMessage();
mailobj.From = "yk_mail@163.com";//邮箱服务器
mailobj.To = Smail;
mailobj.Subject = Title;
mailobj.BodyFormat = MailFormat.Html;
mailobj.Body = Body;
// 通过SMTP服务器验证
mailobj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mailobj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "islet71");//用户名
mailobj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "******");//密码
SmtpMail.SmtpServer = "smtp.163.com";
SmtpMail.Send(mailobj);
}
}
}