Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a private email sending application (Windows), which sends email notifications over SMTP protocol. This might look like a code question for StackOverflow, but it is not. The application works fine and its email sending function works great. The problem is that in some systems, in particular on my Windows 7 Ultimate desktop system, outgoing connections are blocked by something I have hard time identifying.

The problem I see is that at some point very soon from establishing the connection, the socket connection is closed with code 10053, which is 0x2745, which is WSAECONNABORTED, which is "An established connection was aborted by the software in your host machine.". In my host machine, and this is about right - remote server is not the source of disconnection. Sometimes the application still have time to send receive 1-2 messages before the channel is faithfully destroyed by the power from above.

My first guess was that it is simple, it has to be the firewall or antivirus. The only software of this kind that have is built in firewall, and Windows Defender. Turning firewall off is not helpful, Defender is not set to do any real time activity, just is run on demand. The machine is not a part of domain or something - pure standalone.

To add to this, I tried sending over SSL and TLS secure connections and it is not helpful. In the same time I have no problems sending to Google Mail servers. I don't know what makes such a difference, it might be SSL certificate from Google servers in good standing, but it is only particular case.

The questions are: given that the activity is to open socket to remote SMTP server and do the mail thing, what might be the cause in Windows to forcefully close this connection? Are there any tools to troubleshoot this, to find the cause and disable it?

2013-08-08 Update:

WireShark shows the following TCP session:

Wireshark Log

share|improve this question
1  
Most ISPs block outgoing mail ports by default to prevent, um, I mean reduce spam (most only SMTP, but some are more aggressive and block all known outgoing mail ports). If you tried to connect to an SMTP port on a server, your ISP blocks it, and Windows says the connection was aborted. Check with your ISP to see if they are blocking, and if so, if they can unblock it for you (some ISPs add you as an exception if you personally contact them and request it). –  Synetech Aug 29 '12 at 17:02
    
ISP does not look like a feasible cause to me: 1 Thunderbird sends the emails my app cannot, 2 The error code is indicating internal cause (within my computer), 3 I can see a couple of initial SMTP messages such as EHLO handshaking before connection is closed, so the connection is established first and only then later is closed for some reason. –  Roman R. Aug 29 '12 at 17:12
    
can you setup local and simple SMTP server on same machine to see if it makes it? This would at least let you narrow down to your machine as the issue vs. ISP or any external network. –  Kerry Dec 9 '12 at 4:12

1 Answer 1

up vote 1 down vote accepted

Sniffing the network traffic with e.g. WireShark would tell you a lot more about what is happening.

Do you have any details about where in the SMTP dialog the disconnects happen? Is it totally random, or does it have any correlation to any SMTP commands? I strongly suspect there is something unexpected happening in your code that causes the problems.

share|improve this answer
    
The question is a bit old, but I remember sniffing and seeing that I did not see disconnection coming from external source. Neither I did disconnect from my code, which I could easily trace in debugger too. –  Roman R. Aug 8 '13 at 8:56
    
Did you seen any TCP RST packets that terminated the connection and where did they come from, or did your code just return errors indicating broken connections without any evidence of the actual TCP connection being terminated on a packet level? –  krisku Aug 8 '13 at 9:02
    
Yes, I see RST sent from me to remote client (added screenshot above). –  Roman R. Aug 8 '13 at 9:15
    
Packet #9 (FIN) in the screenshot seems to indicate the client is closing the connection immediately after the server has responded with HELO. You need to look at your code and figure out what it is doing. Have you implemented the SMTP protocol yourself or do you use any library? What programming language are you using? –  krisku Aug 8 '13 at 9:21
    
It's C++, with secure layer implemented via SChannel API. I am looking at code... –  Roman R. Aug 8 '13 at 9:22

Your Answer

 
discard

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.