急需帮忙,关于发送Email的一个错误。
MailAddress form1 = new MailAddress( "myemai@163.com ");
MailAddress to1 = new MailAddress( "myemail@163.com ");
MailMessage mail = new MailMessage(form1,to1);
mail.Subject = "testEmail ";
mail.Body = "TestEmail ";
SmtpClient sm = new SmtpClient( "smtp.163.com ");
try
{
sm.Send(mail);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
结果产生以下的错误!请问是什么原因,如何解决,最好能贴些代码!谢谢你的回答!
不允许使用邮箱名称。 服务器响应为: authentication is required,smtp11,wKjADrAbwAJwHixGujylLg==.48396S2 1177296496
------解决方案--------------------System.Net.NetworkCredential login = new System.Net.NetworkCredential(account, password);
smtpClient.Credentials = login;