How to send mail by using C# and SMTP

Introduction :
  Hi, Here i will code you how to send the E-mail Using C#, We Use SMTP (Small Mail Transfer Protocol)
to send the mail from one Address to other. Here We should select Host i have preferred host as Gmail,according to the Host we should provide the Port Address.

I have used two textboxes to enter To-address and Message content to send.Should provide your mail credentials for sending mail.

Aspx code :

<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        To Address
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        Message
        <asp:TextBox ID="TextBox2" Height="100px" TextMode="MultiLine"
            runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Send Mail" OnClick="Button1_Click" /><br />
        <asp:Label ID="lblstatus" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>


 Code Behind (C#) :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;


namespace MailApp
{
    public partial class Page1 : System.Web.UI.Page
    {
        protected void Button1_Click(object sender, EventArgs e)
        {
            string TOAddress = TextBox1.Text;
            MailMessage mail = new MailMessage("Fourthbottle@gmail.com", TOAddress);
            SmtpClient client = new SmtpClient();
            client.Port = 587;
            client.EnableSsl = true;
            client.Host = "smtp.gmail.com";
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Credentials = new System.Net.NetworkCredential("fourthbottle@gmail.com", "MailPassword");
            mail.Subject = "Best Wishes........Open the mail";
            mail.Body = TextBox2.Text;
            client.Send(mail);
            lblstatus.Text = "Mail sent successfully";
        }
    }
}