我遇到了"Relay access denied"的错误,但是我可以通过一些邮件程序连接我的账户。
我的代码:
SmtpClient smtpClient = new SmtpClient();
NetworkCredential basicCredential =
new NetworkCredential("xx@xx.com", "xxx");
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("xx@xx.com");
smtpClient.Host = "mail.xx.com";
smtpClient.Port = 587;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = basicCredential;
message.From = fromAddress;
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
message.To.Add("aa@aa.com");
try
{
smtpClient.Send(message);
}
catch (Exception ex)
{
//Relay access denied...
}
有人知道这个的原因吗?