The server response was: 5.7.1 Unable to relay

SQL Server Database Mail has been configured correctly, but while trying to send a test email, an error is logged in the DatabaseMail log: The server response was: 5.7.1 Unable to relay

After checking the mail log (Management studio –> Connect to SQL Server –> Management –> Right click on Database Mail –> View Database Mail Log, you see the following message:

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account X (date). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Unable to relay).)

The solution is one of 2 things

1. Your Mail Gateway needs to be configured to permit the SQL Server Database mail to relay. In this example I will use the Copperfasten Mail Gateway:

    • Connect to the Copperfasten Administration page
    • System setup –> Mail Relay
    • Add the IP address of the SQL Server which is sending the emails


2. MS Exchange requires a receive connector (these steps apply to MS Exchange Server 2010)

  • On your Exchange Server, open “Exchange Management Console”
  • Expand “Server Configuration”
  • Click on “Hub Transport”
  • In the “Receive Connectors” dialog, right click, and select “New Receive Connector”
  • Enter a name, and select “Custom” from the drop down menu
  • Click Next
  • On “Local Network Settings”, click Next
  • On the “Remote Network settings” dialog,
    • Delete the general IP range
    • Enter the IP address of the SQL Server which is trying to send the email (select the “specify an IP address” radio button)
  • Click “Next”, and “Finish”

You may need to play around with the properties of the connector, using the Authentication and permissions groups, depending on your SQL Server / Network configuration.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.