SSIS Send Mail Task – Error (Mailbox unavailable. The server response was: 5.7.1 Unable to relay)


  • I have a SSIS package that sends an Email attachment to an external Email address.


    I get the following error msg:


    Error: 0xC002F304 at SendMail Task, Send Mail Task: An error occurred with the following error message: "Mailbox unavailable. The server response was: 5.7.1 Unable to relay".


    The error appears when I run the package within Microsoft Visual Studio and through SQL Server Agent.


    If I change the TO: field within the package to an internal Email address.  I do not get the error.


    I enable windows authentication and the error still appears.


    The strange thing is that the Email is send with the attachment.  I do not know if it’s a false positive error.


    Any ideas?



    Thursday, November 05, 2009 11:45 AM


All replies

  • Sounds like a problem with your mail system rather than anything to do with SSIS. | | @jamiet
    • Marked as answer by mkechung Monday, November 09, 2009 12:39 AM
    Thursday, November 05, 2009 11:53 AM
  • The mail server you are trying to use is not allowing your account to send mail to a domain other than internal addresses.  Talk to your e-mail server administrator to get this error straightened out.  It has nothing to do with attachments or what software is running the package.
    Phil Brammer | | Twitter:
    • Marked as answer by mkechung Monday, November 09, 2009 12:39 AM
    Thursday, November 05, 2009 1:48 PM
  • Jamie and Phil was both right and based on additional research the issue was Exchange and not SQL.

    I used the SMTP Telnet to test and to confirm that I can SMTP to internal Email addresses and external Email addresses were denied within my SQL server.

    Internet References:

    How to Allow Anonymous Relay on a Receive Connector

    Configuring Exchange 2007 as an Authenticated or Anonymous SMTP Relay

    By default anonymous users do not have the rights to submit email for external domains so I need to grant permissions, and this has to be done through the Exchange Management Shell.

    Enter the following command:

    Get-ReceiveConnector "connector name" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-Exch-SMTP-Accept-Any-Recipient"

    Connector name = Servername SMTP Internal

    Exchange Management Shell

     [PS] C:\Users\administrator.FIRM\Desktop> Get-ReceiveConnector "Servername SMTP Internal" | Add-ADPermission -User "NT AUTHORITY\ANONYMOUS LOGON" -ExtendedRights "ms-Exch-SMTP-Accept-Any-Recipient"


    Identity             User                 Deny  Inherited Rights

    --------             ----                 ----  --------- ------

    Servername\SERVER... NT AUTHORITY\ANON... False False     ms-Exch-SMTP-Accept-Any-Recipient

     [PS] C:\Users\administrator.FIRM\Desktop> 

     Started the job on WASEBDS02 and the issue has been resolved.

    Monday, November 09, 2009 12:44 AM