急!关于asp.net2.0中发送邮件的问题!高手帮我解决一下!
protected void 发送_Click(object sender, EventArgs e)
{
System.Net.Mail.MailAddress to = new System.Net.Mail.MailAddress(TextBox1.Text);
System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress(TextBox2.Text );
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To = to;
message.From = from;
message.Subject = TextBox3.Text;
message.Body = TextBox5.Text;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
smtp.Host = "mail.163.com ";
smtp.Send(message);
}
------解决方案--------------------http://community.csdn.net/Expert/topic/5248/5248899.xml?temp=.2639734
------解决方案--------------------System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from,to);
vs的debug中都有提示message.To和message.From是只读的,不可以对他赋值,只能在建立类的时候就把他写进去,另外,还需要smtp的验证,楼主要是使用的vs2005 ,可以使用网站管理工具进行配置