550 5.7.54 SMTP; Unable to relay recipient in non-accepted domain Error

Kmcnet 1,116 Reputation points
2025-07-24T01:28:33.97+00:00

Hello everyone and thanks for the help in advance. I am developing a C# .Net 9 Windows Application that uses the SmtpClient to send emails. I have an on premises Exchange Server 2019 that I want the application to connect to for sending emails. I want the C# application to connect to the Exchange Server from a remote location to send the emails. I am trying to send an email to a Gmail account from the application and am receiving a 550 5.7.54 SMTP; Unable to relay recipient in non-accepted domain Error. However, the application is able to successfully connect to the Exchange Server and send emails to internal email recipients. So the application appears to be able to connect to the server and send emails, but not to external emails. However, Exchange users ARE ABLE to send emails to this particular Gmail account. I did try to telnet into the server and send an email and received the same error. So I really have no idea where to look next. In the C# application, I am sending Exchange credentials, but have also tried anonymous, with the same results. Any help would be appreciated.

Exchange | Exchange Server | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vergil-V 2,115 Reputation points Microsoft External Staff Moderator
    2025-07-24T03:59:35.0766667+00:00

    Hi @Kmcnet
    Thank you for reaching out to Microsoft Learn Q&A!
    Based on your description, it seems you're encountering the error: 550 5.7.54 SMTP; Unable to relay recipient in non-accepted domain when attempting to send email from your application to Gmail. 

    As forum moderators, we don’t have access to a dedicated testing environment to replicate complex, user-specific scenarios. However, our goal is to provide helpful insights based on available resources. From my research, this error may be caused by unauthenticated or insufficiently authorized clients attempting to send mail to external domains. 

    To help troubleshoot, could you please double-check the configuration of your Receive Connector’s authentication mechanisms? 

    Please ensure that the Receive Connector on your Exchange server is properly configured to allow relaying for your application. 

    Additionally, here are some official Microsoft resources related to Receive Connectors that may provide valuable insights and are worth reviewing: 

    Receive connectors | Microsoft Learn 

    Allow anonymous relay on Exchange servers | Microsoft Learn 

    Scenarios for custom Receive connectors in Exchange Server | Microsoft Learn 

    If I’ve misunderstood any part of your situation, or if you have further questions or updates, please don’t hesitate to reply.  Thank you for your patience and for working through this with us. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".         

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread 


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.