在SMTP 服务器需要身份验证的情况下,如何使用System.Net.Mail.SmtpClient发送邮件?
现在服务器返回:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required光这样写不行: SmtpClient.Credentials = new System.Net.NetworkCredential(Settings.SmtpUserName, Settings.SmtpPassword);.NET 1.1有这样的办法:
//认证方式,1代表基本认证,一般都是这个选项
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1" );
//你的用户名
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username" );
//你的密码
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password" );
mm是MailMessage,但.NET 2.0咋整??
急!!
现在服务器返回:不允许使用邮箱名称。 服务器响应为: You are not authorized to send mail, authentication is required光这样写不行: SmtpClient.Credentials = new System.Net.NetworkCredential(Settings.SmtpUserName, Settings.SmtpPassword);.NET 1.1有这样的办法:
//认证方式,1代表基本认证,一般都是这个选项
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1" );
//你的用户名
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username" );
//你的密码
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password" );
mm是MailMessage,但.NET 2.0咋整??
急!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货