How to send mail from asp page ?? Here is the solution. ..
we are using google mail [gmail] credentials for send mails from our page. before use the code you must specify the following header
using System.Net.Mail;
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("frommail@gmail.com");
mail.To.Add("Tomail@gmail.com");
mail.Subject = "Test Mail";
mail.Body ="Test Mail";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
use the code and enjoy your mailing .............. :)