system.net.mail.smtpexception "The operation has timed out"

Discussion in '.NET' started by nirav.zenith, Jul 29, 2008.

  1. nirav.zenith

    nirav.zenith

    Joined:
    Jul 29, 2008
    Messages:
    1
    i am sending mail using asp.net and my code is

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Net.Mail;


    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
    SmtpClient client = new SmtpClient();
    client.Host = "hostname";
    client.Port = 2095;
    client.Credentials = new System.Net.NetworkCredential("username", "password");
    //client.EnableSsl = true;
    //client.Timeout = 10000;


    MailAddress from = new MailAddress("from@mail.com");
    MailAddress to = new MailAddress("to@mail.com");

    Attachment att1 = new Attachment("d:\\1.pdf");
    MailMessage msg = new MailMessage(from, to);

    msg.Subject = "Mail Test Success...";
    msg.Attachments.Add(att1);
    msg.Body = "some text for message body";
    try
    {
    client.Send(msg);
    Response.Write("<script> alert('Mail Was Sent Successfully...') </script>");
    }
    catch (Exception ex)
    {
    Response.Write("<script> alert('" + ex.toString() + "') </script>");
    }
    }
    }

    after execution i am getting error

    system.net.mail.smtpexception "The operation has timed out"

    can any one help
    nirav.zenith, Jul 29, 2008
    #1
    1. Advertising

  2. nirav.zenith

    AhmedFarouk

    Joined:
    Feb 1, 2009
    Messages:
    1
    try using : smtp.gmail.com and port 587 then use your account int the NetworkCredential
    AhmedFarouk, Feb 1, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2h1cnJhbSBJc2hmYXEgUmF0aG9y?=

    Operation has timed out in ASP.Net Application

    =?Utf-8?B?S2h1cnJhbSBJc2hmYXEgUmF0aG9y?=, Sep 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    4,227
    =?Utf-8?B?S2h1cnJhbSBJc2hmYXEgUmF0aG9y?=
    Sep 2, 2004
  2. =?Utf-8?B?U2FjaGluIFN1cmFuYQ==?=

    System.WebException | The operation has timed out

    =?Utf-8?B?U2FjaGluIFN1cmFuYQ==?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    10,105
    William F. Robertson, Jr.
    Feb 8, 2005
  3. Matt H.
    Replies:
    1
    Views:
    3,594
    George
    May 11, 2009
  4. Alex Litvak

    random "The operation has timed-out." exception in vb.net

    Alex Litvak, Oct 8, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    290
    Sachin Surana
    Feb 2, 2005
  5. tellierprobable@gmail.com

    System.Net.WebException: The operation has timed-out.

    tellierprobable@gmail.com, Aug 23, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    454
    tellierprobable@gmail.com
    Aug 23, 2006
Loading...

Share This Page