SMTP: Sent Mail – Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it

Scenario:

We were unable to send email using SMTP client. Every time we tried, our event viewer has following entry:

 

Event Type:    Error

Event Source:    XXXXX

Event Category:None

Event ID:    0

Date:        XXXXXX

Time:        XXXXXX

User:        N/A

Computer:    XXXXXX

Description:

Mail Send:error sending email Failure sending mail. at System.Net.Mail.SmtpClient.Send(MailMessage message)

at Mail.Send(String from, String to, String subject, String body, Boolean sendAsHTML) in XXXXXXXXX:line 675 System.Net.WebException: Unable to connect to the remote server —> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)

at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

— End of inner exception stack trace —

at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout)

at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)

at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)

at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)

at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)

at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)

at System.Net.Mail.SmtpClient.GetConnection()

at System.Net.Mail.SmtpClient.Send(MailMessage message)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

 

Resolution:

McAfee OAS is running on our system and blocks all email. Add exe in the allow list of McAfee.

Virus Scan Console -> Access Protection -> Prevent mass mailing worms from sending mail -> Edit -> Add exe in (Process to exclude list)

You can verify it by checking the logs

Virus Scan Console -> Task -> View Logs

Advertisements

8 Comments »

  1. Major props to you! Thanks!

  2. Karthik said

    Excellent piece of info!! Thanks a lot- this worked for me.

  3. Ric said

    You just saved me about half a day’s worth of work. Thank you!!!!

  4. illbreed said

    Thanks!!! this worked great for me!

  5. Anonymous said

    Many thanks. This issue had me stumped for a week!

  6. Piotr said

    U saved my sanity – I could’t even imagine that would be McAfee

  7. Jayanth said

    Perfect! It worked like a charm.

  8. Csaba said

    It was my problem as well. Thanks for your help! Helps a lot

RSS feed for comments on this post · TrackBack URI

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: