"The mail could not be sent to the recipients because of the mail server failure. Exception Message: Could not connect to mail server. (An attempt was made to access a socket in a way forbidden by its access permissions (IP))."
A recent McAfee Anti-Virus update began to block programs from sending mail unless they appear on a list of excluded programs. SQL Server Database Mail does not appear on that list by default.
You may see an error in the McAfee logs such as:
Date_Time - (Path)\MSSQL\Binn\DatabaseMail.exe Anti-virus Standard Protection:Prevent mass mailing worms from sending mail (IP)
- Go to the Access Protection Properties in the VirusScan console.
- Select Anti-Virus Standard Protection.
- Highlight mass mailing worms, and edit the property.
- Add DatabaseMail.exe to the list of excluded programs.
This was seen on SQL Server 2012, though it is relevant to all SQL Server versions using Database Mail and has to do with the McAfee configuration.