How to send mail by using System.Net.Mail?

Unknown | 9:52 AM |

using System;
using System.Net.Mail;
using System.Net.Security;
public partial class SendEmailPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MailMessage oMailMessage = new MailMessage("Your Email Address ", "Recepent’s Email Address ");
        oMailMessage.Subject = "Write Your Mail Here";
        oMailMessage.Body = "Write Your Email Message";
        oMailMessage.IsBodyHtml = false;
        SmtpClient oSmtpClient = new SmtpClient("smtp.gmail.com", 587);
        oSmtpClient.Credentials = new System.Net.NetworkCredential("Email Username", "Email Password");
        oSmtpClient.EnableSsl = true;
        oSmtpClient.Send(oMailMessage);
    }
}


Category:

About http://dotnetvisual.blogspot.in/:
DOT NET TO ASP.NET is a web application framework marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any Microsoft .NET language. create an application very easily ....