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

  • Home
  • SEARCH
  • 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 6570927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:49:05+00:00 2026-05-25T14:49:05+00:00

When I sent a mail using System.Net.Mail, it seems that the messages do not

  • 0

When I sent a mail using System.Net.Mail, it seems that the messages do not send immediately. They take a minute or two before reaching my inbox. Once I quit the application, all of the messages are received within seconds though. Is there some sort of mail message buffer setting that can force SmtpClient to send messages immediately?

public static void SendMessage(string smtpServer, string mailFrom, string mailFromDisplayName, string[] mailTo, string[] mailCc, string subject, string body)
{
    try
    {
        string to = mailTo != null ? string.Join(",", mailTo) : null;
        string cc = mailCc != null ? string.Join(",", mailCc) : null;

        MailMessage mail = new MailMessage();
        SmtpClient client = new SmtpClient(smtpServer);

        mail.From = new MailAddress(mailFrom, mailFromDisplayName);
        mail.To.Add(to);

        if (cc != null)
        {
            mail.CC.Add(cc);
        }

        mail.Subject = subject;
        mail.Body = body.Replace(Environment.NewLine, "<BR>");
        mail.IsBodyHtml = true;

        client.Send(mail);
    }
    catch (Exception ex)
    {
        logger.Error("Failure sending email.", ex);
    }

Thanks,

Mark

  • 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-05-25T14:49:06+00:00Added an answer on May 25, 2026 at 2:49 pm

    Try this, if you’re on Dotnet 4.0

    using (SmtpClient client = new SmtpClient(smtpServer))  
    {
        MailMessage mail = new MailMessage();
        // your code here.
    
        client.Send(mail);
    }
    

    This will Dispose your client instance, causing it to wrap up its SMTP session with a QUIT protocol element.

    If you’re stuck on an earlier dotnet version, try arranging to re-use the same SmtpClient instance for each message your program sends.

    Of course, keep in mind that e-mail is inherently a store-and-forward system, and there is nothing synchronous (or even formally predictable) about delays from smtp SEND to reception.

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

Sidebar

Related Questions

I'm using System.Net.Mail to send out a few emails. The emails are being sent
I am using System.Net.Mail to to send mail. I do not know the type/version
How can I send an email using SYstem.Net.Mail to an email address that is
I'm using System.Net.Mail to send email, like so : MailMessage message = new MailMessage();
I use C# to send email using System.Net.Mail. But How can I know whether
I am using a simple mail sender class that uses the System.Net.Mail . I
am using system.net.mail to send email as shown below, but its too slow. it
I'm using system.net.mail and have a textbox that users can enter their email address
If I've queued up some email to be sent via the System.Net.Mail.SMTPClent, where can
I'm trying to attach a PDF attachment to an email being sent with System.Net.Mail.

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.