邮件发送不成功
大家好,帮忙看下以下代码为什么发送不成功?谢谢
protected void Button1_Click(object sender, EventArgs e)
{
string mailfrom = "yanlong_521521521@163.com ";
string name = mailfrom.Substring(0, mailfrom.IndexOf( "@ "));
MailMessage mes = new MailMessage(mailfrom, "yanlong_521521@163.com ", "祝福 ", "好好 ");
mes.BodyEncoding = System.Text.Encoding.GetEncoding( "gb2312 ");
mes.IsBodyHtml = true;
SmtpClient client = new SmtpClient( "smtp.163.com ");
client.Credentials = new NetworkCredential(name, "来自邮件密码 ");
client.Send(mes);
}
错误提示说:邮箱不可用。 服务器响应为: Óû§±»Ëø¶¨
请问一下,怎么解决呢.谢谢.
------解决方案--------------------mailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1 ");
mailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ", this._MailFrom);
mailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ", this._MailFromPwd);
------解决方案--------------------我的可以发呀,不行你加上这句 client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential(name, "来自邮件密码 ");
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(mes);