Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using this piece of code to send a mail:

SmtpClient client = new SmtpClient();
client.Host = smtpServer;

If I trigger this code ten times/second, then after some hundred mails, sending a mail takes 10 seconds... Could there be a queue involved here?

share|improve this question
up vote 5 down vote accepted

Looks like the mail server is forcing this delay, probably in order to avoid spam:

What mail server are you using? How is it configured? Are you using authenticated or unauthenticated SMTP to send mails?

share|improve this answer
Either a delay from the server, ot it is overloaded - depends how the SMTP server looks. I remember "killing" a company exchange by doing what I Was asked for - submitting 50.000 emails as fast as possible ;) – TomTom Apr 18 '10 at 13:40

As Massimo said, many smart SMTP servers have a throttle capability. It could also be limited external to the SMTP server using network throttling.

If your code is blocking, you should send this asynchronously. You can either use the .SendAsync() method on the SmtpClient, which is not my favorite, or using something like SmartThreadPool to create a thread for each message.

If you're sending these asynchronously, you will not be able to enclose the message in a using() statement, so you will need to call .Dispose() on the MailMessage, or there will be resource issues.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.