unable to send email from localhost
<p>I am trying to send mail from localhost with the following asp.net code..but email sending is becoming failed..</p>

<p>why is it so/???</p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)

{

    MailMessage mail = new MailMessage();

    string name = TextBox1.Text.ToString();
    string contact = TextBox2.Text.ToString();
    mail.To.Add("email@gmail.com");

    mail.From = new MailAddress(name.Trim());


    mail.Subject = "In line image test";

    mail.Body = "Hello email...." +name.Trim() +", "+contact.Trim();

    mail.IsBodyHtml = true;

    SmtpClient client = new SmtpClient("127.0.0.1");
    client.UseDefaultCredentials = false;
    client.EnableSsl = true; 
    client.Host = "127.0.0.1";
    client.Port = 25;

    NetworkCredential credentials = new NetworkCredential("email@gmail.com", "abc");

    client.Credentials = credentials;

    try
    {

       client.Send(mail);
    }
    catch
    {

        Button1.Text = "Fail";

    }
}
</code></pre>

<p>Thanks in advance..</p>
