nik codes

Actively refused connections

Recently I was using the System.Net.Mail namespace to send out email messages from a simple .net application.  I was receiving an error which boiled down to “the server is actively refusing the connection.”

This message is not particularly helpful.  If you run into this issue you might want to check that your mail server will allow SMTP relays.  My server was set to allow SMTP relays – yet I was still getting the issue.

I found a Microsoft tool called SMTPDiag (for use with Exchange server) that runs through the network performing various test to find out why SMTP is not working.

I ended up failing on one of the final steps – connecting to the exchange server.

I ran

netstat -n -a

on the server and found that port 25 was open and listening.

Then on my client machine I tried to create the simplest connection I could to the server:

telnet [mailServer] 25

This refused to connect as well. 

I checked the firewall to see if port 25 was blocked in some way and it was not.

I was basically flabbergasted and about to give up when my anti-virus program popped up to do an update.  A light bulb went off in my head.


McAffee ANtiVirus was blocking all outgoing traffic over port 25 on my machine.  I didn’t even think about anti-virus blocking ports, but it is quite common, especially with mail ports.  I felt like an idiot, but I decided to share my experience to help others out there.

PS – SMTPDiag is quite useful, and Marc Grote has a good tutorial on it.

Single Post Navigation

One thought on “Actively refused connections

  1. Thanks!!! I wish I’d have found this 3 hours ago. Better late than never though 😉

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: