Sending Email to Different Domains using SQL Server
Out of the box, SQL Server’s database mail feature does not allow sending mails to different domains.
Error message is:
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using
Account 2 (2009-11-30T09:44:39). Exception Message: Cannot send mails to mail server. (Mailbox
unavailable. The server response was: 5.7.1 Unable to relay for [email protected]).
This is not actually an issue with SQL Server but the configuration of Exchange Server. Exchange Server is not allowing relaying from SQL Server. You need to add the SQL Server ip address to allow sending emails to a different domain by using below steps.
On Mail server > Exchange Server Manager > SMTP Connector Properties > Access Properties > Access
Tab > Relay button > added ip address of SQL Server