I have two almost identical Windows Server 2008 R2 servers set up with Microsoft SQL Server 2012.
- One server has a hardware firewall with port 25 open in both directions (plus opening RDP to certain IPs and opening ports 80 and 443)
- One server uses a Windows firewall (default options, plus restricting RDP to certain IPs and opening ports 80 and 443)
I can send emails using msdb.dbo.sp_send_dbmail
on the server with the Windows firewall. However the server with the hardware firewall returns in the log [msdb].[dbo].[sysmail_log]
The mail could not be sent to the recipients because of the mail
server failure. (Sending Mail using Account 1 (2012-11-04T14:25:02).
Exception Message: Cannot send mails to mail server. (Service not
available, closing transmission channel. The server response was:
Connection not accepted at this time). )
The email accounts and profiles are set up identically on both servers.
Does anyone have any idea why? I assume it is something to do with the firewall, although its possible one IP could be blocked by the mailserver.
Thanks!
Best Answer
I never got to the bottom of why this was happening. I spoke to support from the company providing the smtp mail server, who blamed the company responsible for the IP address, and vice versa.
However I used instead the mail server for gmail (smtp.gmail.com with SSL selected and port 587, Basic authentication) and the mails were sent correctly. [obviously I needed to open port 587 in the firewall first]
I then went a step further, and configured gmail to use the original settings for the smtp mail server, and this also worked!