Authentication Error in C# Send Mail App
Posted
by doc
on Stack Overflow
See other posts from Stack Overflow
or by doc
Published on 2010-05-03T20:43:48Z
Indexed on
2010/05/03
20:48 UTC
Read the original article
Hit count: 275
I'm developing a simple send mail app in C#, using my CMail Server:
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
mail.Subject = "Sub";
mail.Body = "Hi!";
SmtpClient smtp = new SmtpClient("MyServer");
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("user", "pass");
smtp.UseDefaultCredentials = false;
smtp.Credentials = cred;
smtp.Send(mail);
Obviously i ommited my account information, so, this code throws me an Authentication Exception for some reason. I first thought that the code was wrong, so i change the info to my gmail account and everything goes fine, with the only SMTP server that i having trouble is with the CMail. Is there a problem with .NET and CMail's SMTP ?
Thanks for the help and comments!
© Stack Overflow or respective owner