"The operation has timed out" when trying to send email

Posted by user1718859 on Stack Overflow See other posts from Stack Overflow or by user1718859
Published on 2012-10-04T03:06:00Z Indexed on 2012/10/04 3:37 UTC
Read the original article Hit count: 83

Filed under:
|
protected void Button1_Click(object sender, EventArgs e)
{
    try
    {
        SmtpClient sm = new SmtpClient();
        MailMessage ms = new MailMessage();
        ms.To.Add(new MailAddress(TextBox1 .Text ));
        ms.Subject = TextBox2.Text;
        ms.Body = TextBox3.Text;
        ms.IsBodyHtml = true;
        sm.Send(ms);
    }
    catch (Exception el)
    {
        Response.Write(el.Message);
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET