how to send mail on server
private void SendActivationEmail(string b)
{
//string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
//// string activationCode = Guid.NewGuid().ToString();
//using (SqlConnection con = new SqlConnection(constr))
//{
//}
using (MailMessage mm = new MailMessage("[email protected]", "tomail"))
{
mm.Subject = "Mavro Commitement OTP";
string body = " ";
body += "
Your Generated One Time Password is: ";
body += "
";
";
body += "
Thanks
";Thanks
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.mavromining.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "*******");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25; //smtp.Port = 587
smtp.Send(mm);
}
}
gives error:---
Server does not support secure connections port:25
and
No connection could be made because the target machine actively refused it port:587
please provide me solution of this problem
Raja TPosted Jan 11, 2016, 10:29 PM
That error message is typically caused by one of the following:
Rajeesh MenothPosted Jan 11, 2016, 8:27 PM