|
private void btnSend_Click(object sender, System.EventArgs e)
{
MailMessage mailMsg=new MailMessage();
mailMsg.To=txtTo.Text;
mailMsg.From=txtFrom.Text;
mailMsg.From=this.txtsubject.Text;
mailMsg.Body=txtMsg.Text;
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","soundblas@163.com");
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","6311455");
try
{
SmtpMail.SmtpServer="smtp.163.com";
SmtpMail.Send(mailMsg);
Response.Write("ok");
}
catch(Exception ex)
{
Response.Write("false;");
}
}
}
请问我跟书上写的一模一样,书上说可以发邮件为什么我运行后都是FALSE,希望能指导我应该怎么去写 |
|