首页 新闻 会员 周边 捐助

MailMessage

0
悬赏园豆:5 [已解决问题] 解决于 2012-04-24 14:58

"不允许使用邮箱名称。 服务器响应为: authentication is required,smtp4,DtGowECZp2PhAI1P3TLlHg--.313S2 1334640868"

C#
Philomena的主页 Philomena | 初学一级 | 园豆:154
提问于:2012-04-17 14:12
< >
分享
最佳答案
0

client.UseDefaultCredentials = true;

要放在

client.Credentials = new NetworkCredential("用户名", "密码");

的前面,你检查一下是否是这个原因

收获园豆:5
artwl | 专家六级 |园豆:16736 | 2012-04-17 14:31

System.Text.Encoding encoding = System.Text.Encoding.Default;
SMTPItem s = this.si;
smtpClient.Host = s.Server;
NetworkCredential nc = new NetworkCredential();
nc.Password = s.PassWord;
nc.UserName = s.UserName;
MailMessage mm = new MailMessage();
mm.From = new MailAddress(s.SendMail, s.Sender,encoding);
mm.IsBodyHtml = false;
mm.Subject =Properties.Settings.Default.产品名称+"测试";
mm.SubjectEncoding = encoding;
mm.Body ="这是一封测试邮件";
mm.BodyEncoding = encoding;
mm.To.Add(Properties.Settings.Default.testMailAddress);
smtpClient.UseDefaultCredentials = true;//在这里加了您说的,还是出错,,请指教
smtpClient.Credentials = nc;
//smtpClient.Send(mm);
this.progressBar1.Enabled = true;
smtpClient.SendAsync(mm,new object());
smtpClient.SendCompleted += new SendCompletedEventHandler(this.SendComplete);

Philomena | 园豆:154 (初学一级) | 2012-04-17 14:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册