If you are getting SMTH AUTH errors while trying to send e-mails using the SmtpClient to an smtp server that requires authentication, make sure that you call UseDefaultCredentials before settings the credentials.
So, order is important here!
using System.Net;
using System.Net.Mail;
...
using (var client = new SmtpClient())
{
client.Host = "smtp.teamfoundationserver.de";
client.Port = 25;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(username, password);
client.Send(message);
}
Good luck!
No comments:
Post a Comment