请教asp.net中关于邮件发送问题,急急急
protected void Button1_Click(object sender, EventArgs e)
{
System.Net.Mail.MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress( "xiaowang@163.com ");
mailMessage.To.Add( "xiaoli@163.com ");
mailMessage.Subject = "Hello ";
mailMessage.Body = " 我想发一个邮件 ";
sendMail(mailMessage);
}
//SendMail
private void sendMail(MailMessage mail)
{
SmtpClient smtpClient = new SmtpClient();
smtpClient.EnableSsl = true;
smtpClient.Host = "smtp.163.com ";
smtpClient.Port = 25;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials =new NetworkCredential;
( "xiaowang ", "xxxx ", "1 ");
try
{
smtpClient.Send(mail);
Label1.Text = "ok ";
}
catch(Exception e)
{
Label1.Text = e.Message;
}
}
我的后台代码就是这样写的,结果运行时候就回报错,内容是:服务器不支持安全连接,不知道是什么原因,
------解决方案--------------------不是很清楚了吗?
------解决方案--------------------是你系统的问题