No answer found even after searching many sites
i am using VS2010(Frame work 4.0) and SQL 2012 , we are using exchange server....same mail configuration is working in java application but not working in c#
button click code is :
try
{
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.myorganization.com"
smtp.Port = "587";
smtp.Credentials = new System.Net.NetworkCredential("abc@myorganization.com", "password");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.EnableSsl = true;
MailMessage msg = new MailMessage();
msg.From = new MailAddress("abc@myorganization.com");
msg.To.Add(new MailAddress("receiver@something.com"));
msg.Subject = "Test";
msg.Body = "Test mail";
smtp.Timeout = 60000;
smtp.Send(msg);
result = true;
}
catch (Exception ex)
{
}
My exception error is
System.Net.Mail.SmtpException was caught
HResult=-2146233088
Message=Authentication failed.
Source=System
StackTrace:
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at MailConfiguration.TestMail() in