您的位置:首页 > 大数据 > 人工智能

使用jMail组件发送邮件(.NET)

2008-06-11 17:13 549 查看
try
{
jmail.MessageClass MyMail = new jmail.MessageClass();
MyMail.Charset = "GB2312";
MyMail.Encoding = "BASE64";
MyMail.ContentType = "text/html";
MyMail.ISOEncodeHeaders = false;
MyMail.Priority = Convert.ToByte(1);
MyMail.From = "wwwww#163.com";//发件人邮箱地址
MyMail.FromName = "wwww";//发件人姓名
MyMail.Subject = "测试哦!";//邮件主题
MyMail.MailServerUserName = "wwww";//身份验证用户名
MyMail.MailServerPassWord = "********";//用户密码
MyMail.AddRecipient("wwwww#163.com","","");//收件人信箱
MyMail.Body = "恭喜发财!";//邮件内容
if (MyMail.Send("smtp.163.com", false))
{
Response.Write("<script>alert('邮件发送成功!');history.go(-1);</script>");
}
else
{
Response.Write("<script>alert('邮件发送失败,请重新发送!');history.go(-1);</script>");
}
MyMail = null;
}
catch (Exception ex)
{
Response.Write("<script>alert('"+ex.Message.ToString()+"');history.go(-1);</script>");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: