using System.Net.Mail;
using System.Net.Mime;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
MailMessage mailObj = new MailMessage(MailFrom.Text, MailTo.Text, Head.Text, Message.Text);
SmtpClient SMPTServer = new SmtpClient("smtp.gmail.com");
SMPTServer.Credentials = new System.Net.NetworkCredential("your-email@address.com", "password");
try
{
SMPTServer.Send(mailObj);
Response.Redirect(@"~\Default.aspx");
}
catch (Exception ex)
{
Response.Write(ex);
}
}
}