I want my application to send e-mail using 'SMTP over SSL' even if TLS is not supported by server. So far I have tried
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("abc@xyz.com");
mail.To.Add("to_address");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true; //true: sends using TLS, false: sends without security
SmtpServer.Send(mail);
MessageBox.Show("Mail sent");
}
catch (Exception ex)
{
MessageBox.Show("Error" + ex.ToString());
}
by setting the property called EnableSsl, I can send mail over the servers which support TLS but I am not able to send it through server which only supports SMTP over SSL. How can I give support for this SMTP/SSL method?