I've got the error "Relay access denied", but I can connect my account with some email programs.
My code:
SmtpClient smtpClient = new SmtpClient();
NetworkCredential basicCredential =
new NetworkCredential("[email protected]", "xxx");
MailMessage message = new MailMessage();
MailAddress fromAddress = new MailAddress("[email protected]");
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("[email protected]");
try
{
smtpClient.Send(message);
}
catch (Exception ex)
{
//Relay access denied...
}
Does anyone know the reason for this?