Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:59:31+00:00 2026-06-17T16:59:31+00:00

Intro: I am supporting a piece of code that sends a welcome/confirm mail upon

  • 0

Intro: I am supporting a piece of code that sends a welcome/confirm mail upon successful registration to a site.

The SMTP client times out before sending can complete. According to our Ops department, I am using the correct credentials and SMTP server IP address.

What I want to do is hook into any handshaking, connection, sending, etc events so that I can figure out exactly why the process times out. I’ve set Server.ScriptTimeOut to 500 seconds on that page, so it can’t just be a busy server problem.

My question is this: what events can I handle during this process. The only one I see exposed in SMTPClient is SendCompleted. But I imagine there must be a way to get access to something more low-level?

For reference, here’s the code:

//Create and send email
MailMessage mm = new MailMessage();
try
{
    mm.From = new MailAddress("admin@site.com");
    mm.To.Add(new MailAddress(Recipient));
    mm.Subject = Subject;
    mm.Body = MailBody;
    mm.IsBodyHtml = true;

    var c = new NetworkCredential("admin@site.com", "YeOlePassword");

    SmtpClient smtp = new SmtpClient("127.0.0.1");//not really, just hiding our SMTP IP from StackOverflow

    smtp.UseDefaultCredentials = false;
    smtp.Credentials = c;
    smtp.Send(mm);

}
catch (Exception x)
{
    DateTime CurrentDateTime = DateTime.Now;
    String appDateTime = CurrentDateTime.ToString();

    String transactionLogEntry = "To: " + Recipient + " " + appDateTime + " " + x.Message;
    StreamWriter streamwriter = new StreamWriter(File.Open(MapPath("~/TransactionLog.txt"), FileMode.Append, FileAccess.Write, FileShare.Write));

    //Append to file
    streamwriter.WriteLine(transactionLogEntry);
    //Close file
    streamwriter.Close();
}

The error that’s logged is simply that a timeout occured while sending a mail to the supplied email address.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:59:32+00:00Added an answer on June 17, 2026 at 4:59 pm

    I use this to get the buried SMTP messages out.

    String transactionLogEntry = "To: " + Recipient + " " + appDateTime + " " + GetFullErrorMessage(x);
    
    .
    .
    .
    
    private string GetFullErrorMessage(Exception e)
        {
            string strErrorMessage = "";
            Exception excpCurrentException = e;
    
            while (excpCurrentException != null)
            {
                strErrorMessage += "\"" + excpCurrentException.Message + "\"";
                excpCurrentException = excpCurrentException.InnerException;
                if (excpCurrentException != null)
                {
                    strErrorMessage += "->";
                }
            }
    
            strErrorMessage = strErrorMessage.Replace("\n", "");
    
            return strErrorMessage;
        }
    

    In my experience, from what you are describing it is related to your SMTP port being blocked by and ISP or your server/web host. Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are supporting an aging VB6 system that we have written new code for
Intro: Web application, ASP.NET MVC 3, a controller action that accepts an instance of
What is the first version of PHP that started supporting the PDO_SQLite driver? I
I understand that Android's developer site provides information on this topic. I have already
Currently supporting a project that includes both frameworks... Hence having a question for these
My application is supporting 3 type of density ldpi (120),mdpi(160),hdpi(320) and for that we
having an issue supporting IE6 (meh).. I have an update panel that is triggered
In my SharePoint code, I have the following line: SPWeb web = site.RootWeb; //site
The iPad app that I'm currently working on reads .epub files from the Supporting
I am supporting an ETL process that transforms flat-file inputs into a SqlServer database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.