var fromAddress = "dhiraj@xyz.in"; // any address where the email will be sending var toAddress = "xyz@yahoo.com"; const string fromPassword = "1234"; // Passing the values and make a email formate to display string subject = "test"; string body = "From: " + "dhirajmane" + "\n"; body += "Email: " + "dhiraj@xyz.in" + "\n"; body += "Subject: " + "hi dhiraj send this mail" + "\n"; body += "Question: \n" + "was up" + "\n"; // smtp settings var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "103.21.58.111"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); smtp.Timeout = 20000; } // Passing values to smtp object smtp.Send(fromAddress, toAddress, subject, body); Response.Write("E-mail sent!");
smtp.EnableSsl = true;
smtp.EnableSsl = false;
Please check the following link: <a href="http://www.storm-consultancy.com/blog/development/code-snippets/sending-email-with-gmail-smtp-server-in-asp-net/">http://www.storm-consultancy.com/blog/development/code-snippets/sending-email-with-gmail-smtp-server-in-asp-net/</a> <a href="http://stackoverflow.com/questions/454277/how-to-enable-ssl-for-smtpclient-in-web-config">http://stackoverflow.com/questions/454277/how-to-enable-ssl-for-smtpclient-in-web-config</a>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)