Authentication Error in C# Send Mail App
- by doc
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!