login about faq

Your web site ( http://www.cknotes.com/?cat=138) describes quite clearly the reasons for WSAEWOULDBLOCK

Some of my customers using smtpQ are experiencing this failure but it is not clear why, at that point, the solution is to restart the smtpQ service.
Immediately after the restart, the emailing resumes without a problem.

1. why would this error block any future emails until the service is restarted? Isn't the service designed to try again if there are emails queueud in the Outgoing folder?

  1. Do you have a sample code designed to detect this situation and automatically restart the service?

asked Feb 05 '13 at 17:00

chilkat's gravatar image

chilkat ♦♦

It may be that each of the threads gets stuck for a while because:

1) An attempt to send the email fails after a timeout (i.e. WSAEWOULDBLOCK)
2) The thread goes into a rety sequence, where MaxRetries = 10.

The MaxRetries can be configured to use from 0 to 10 retries (for sending mail). The delay time between each subsequent retry is according to this schedule:

tryCount            delayTime
--------            ---------
1                   5 sec
2                   10 sec
3                   15 sec
4                   1 minute
5                   1.5 minutes
6                   2  minutes
7                   5 minutes
8                   10 minutes
9                   15 minutes
10                  20 minutes

When the MaxThreads are busy re-trying each of the emails, the queue will become blocked. The solution is to:

1) Determine the cause for the WSAEWOULDBLOCK, which may be a firewall, anti-virus, nothing listening at the remote host:port, etc. and fix it.


2) Perhaps configure the SMTPQ's MaxRetries property to a lower value (anything from 0 to 10 is OK).

The only REAL solution is to determine the cause of the blocked connection.


answered Feb 05 '13 at 17:04

chilkat's gravatar image

chilkat ♦♦

The problem persists for a couple of days once it starts. And it immediately gets fixed upon a restart of the smtpQ service.
The problem begins when the smtpQ suddenly starts using the Local Machine instead of the specified server as the connection target. The email message is specified using the correct server name, but the smtpQ process is trying to connect to the local machine instead:

Need new SMTP connection checkForExistingConnection: Elapsed time: 0 millisec SMTP_Connect: Connecting to SMTP server

Is there a known scenario that causes smtpQ to suddenly start using the local machine address instead of the specified server?


answered Feb 05 '13 at 17:53

ixm7's gravatar image


Each email sent by the SMTPQ service is sent by doing the following:

1) Loads the .eml into an email object.
2) Extracts the information from the encrypted headers (SMTP host, port, etc.)
3) Removes the encrypted headers.
4) Instantiates a mailman instance, sets the properties with the values from the headers, and sends.

The "" could only have come from the headers.

(Feb 05 '13 at 18:02) chilkat ♦♦

Thanks for the quick responses! I'll ask the user to send me the eml file. Perhaps the problem was between the chair and the keyboard...


answered Feb 05 '13 at 20:11

ixm7's gravatar image


PS> If it's OK with your user, please send me one of the .eml files. Also, you may edit it by taking out the header that would have the encrypted password (so I won't see it). I can then decrypt the headers and see what is actually there.

I stated that the "" could only have come from the headers, and I don't see how it could be untrue -- but you never know...

(Feb 05 '13 at 20:27) chilkat ♦♦

Today, another user reported a blocked smtpQ scenario. One "bad" eml caused ALL following eml files to be stuck in the Outgoing folder. This is NOT an issue of retries -- the blocking persisted for much longer. Sending resumed immediately when the bad eml file was removed from the Outgoing folder.

Question: is there a known mechanism whereby the smtpQ service would get blocked because of one bad eml file. For example, does smtpQ use the smtp server and port specified in EACH eml file, or does it reuse the info from the first eml file to "save time"? Is there a way to force the smtpQ service to NOT reuse connection information from the first eml file?


answered Feb 05 '14 at 07:59

ixm77's gravatar image


I received further clarification from the user:

  1. The bad email did not remain in the Outgoing folder, it got moved to the Undeliverable folder. But the rest of the eml files remained in the Outgoing folder (MUCH longer than the retry cycles).

  2. The bad eml file was targeting a different smtp server (compared to all the other eml files). This leads me to believe that smtpQ hangs when one email fails, and the rest of the emails target a different smtp server.

  3. Emailing resumed when the eml files in the outgoing folder were copied to a different folder, and then moved back to the Outgoing folder.


answered Feb 05 '14 at 19:47

ixm77's gravatar image


This old problem still persists. It boils down to the following scenario: after a WSAEWOULDBLOCK failure, the smtpQ hangs indefinitely. This is not due to retries because the service remains hung until it is restarted. A restart immediately solves the issue. Is there a known explanation/fix?


answered Aug 04 '15 at 09:27

ixm7's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Feb 05 '13 at 17:00

Seen: 2,179 times

Last updated: Aug 04 '15 at 09:27

powered by OSQA