المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Email - invalid remote certificate



C# Programming
08-10-2010, 09:40 PM
I am writing a program to send email. When I send from my own email accounts everything works! When I send from my company email or any other emails from the company I get the error: “The remote certificate is invalid according to the validation procedure”
The code looks like this:
mailObj = new SmtpClient("smtp. MyCompany.com", 25);
from = new MailAddress("xxxxxx@MyCompany.com", "Chris H");
AuthInfo = new NetworkCredential(from.Address, "xxxxxxxxxxx");
to = new MailAddress("xxxxxxxx@hotmail.com", "Chris H");
MailMessage mail = new MailMessage(from, to);
mail.Subject = "Testing";
mail.Body = "Hello Everybody";

mailObj.UseDefaultCredentials = false;
mailObj.EnableSsl = true;
mailObj.Credentials = AuthInfo;
mailObj.Send(mail);

I have noticed that in our Outlook account settings - More Settings - Outgoing server we need to check the My outgoing server (SMTP) requires authentication and "Use same settings as my incoming mail server"

This would make me think my program should be able to get the authentication info need from the incoming mail server but how??

Any words of wisdom would be appreciated.