C# – Sending out an email using SMTP

cnetsql serverssis

I am using the Send Mail Task in SSIS 2008 to send out an email.

I am using SMTP. I have SMTP set up in the IIS manager.

I have set it to use windows authentication.

The From and To mail address both exist.

When i configure the task to send an email, i get an error

"[Send Mail Task] Error: An error occurred with the following error message: "Failure sending mail.
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 127.0.0.1:25"

What IIS or SSIS config change has to be made for this to work?

Best Answer

Check your firewall and/or virus scanner; port 25 (the default SMTP port) is often blocked by this type of software. Not sure about the SSIS Send Mail Task specifically, but SQL Server SMTP Mail service can be configured to use a different port.

If you're in a corporate environment, it's likely that your network guys have some sort of SMTP relay you could/should use instead of the local host, and they might also have some sort of IP and/or email address whitelist they need to include you on in order to relay SMTP mail.

Related Topic