62,046
社区成员
发帖
与我相关
我的任务
分享
public void SendMail()
{
try
{
//创建邮件
MailMessage myMail = new MailMessage("你的邮箱地址","要发到的地址","主题","内容");
//设置优先级
myMail.Priority = MailPriority.High;
//发送邮件
SmtpClient client = new SmtpClient("smtp.163.com", 25); //不同的邮箱设置不同
client.Credentials = new System.Net.NetworkCredential("你的邮箱", "密码");
client.Send(myMail);
}
catch
{
//错误信息提示
Response.Write("<font color=red>邮件发送失败!原因可能是:1)收件人地址不存在 2)发件人地址不存在 3)用户名或密码错误</font>");
}
finally
{ }
}