Forum Discussion

Jim Owen's avatar
Jim Owen
Copper Contributor
Sep 09, 2018

Relay Access Denied 5.7.64 Tenant Attribution

We’ve run into a problem were we are unable to set up an email relay within our network that will relay to Office 365 and then out from there. We’ve been through article after article found through Google but none have resolved.

 

The problem is that when relaying to an address outside our domain, we receive an error message stating:

"Mailbox unavailable. The server response was: 5.7.64 TenantAttribution; Relay Access Denied [CO1NAM04FT026.eop-NAM04.prod.protection.outlook.com]"

The original host name we connect to is  [domain].mail.protection.outlook.com where [domain] is the specific host assigned to us.

 

This error is occurring when attempting to relay mail through the server from C#.

 

Code looks as follows:

var hostName = ConfigurationSettings.AppSettings[mailServerKey];

using (SmtpClient client = new SmtpClient(hostName))

{

    //  Have also tried without credentials

    client.Credentials = new System.Net.NetworkCredential("MailAddress", "Password");

    client.Port = 25;   // Have also used 587

    client.EnableSsl = false;   // Have used true with port 587

    for (int i = 0; i < mailArray.Count; i++)

    {

        try

        {

            //Retrieve the MailMessage object

            MailMessage mail = (MailMessage)mailArray[i];

            client.Send(mail);

        }

        catch (System.Exception e)

        {

            LogError(e);

        }

    }

}

 

Any suggestions for a next step to take would be appreciated.

 

Thanks,

Jim

2 Replies

  • Adam Ochs's avatar
    Adam Ochs
    Steel Contributor

    Hello Jim Owen,

     

    I hope I can help you out here.

     

    In short, you need to make sure you have a TLS connector configured for the server that is running CSharp, assuming that the IP is a dedicated IP. The error you are getting normally is related to the fact that you have a connector configured by either the cert of the IP do not match.

     

    https://support.microsoft.com/en-us/help/4051495/550-5-7-64-tenantattribution-relay-access-denied-smtp-error-when-users

     

    Microsoft does not like relaying through their clouud/exchange online as a whole. They do however make an exception for when you are sending from a known trusted device, hence why a connector is needed.

     

    So if you do not have one setup a TLS connector to that server. If you do, check the cert and IP to be sure they are up to date and correct in your connector.

     

    That should solve the issue.

     

    Adam

    • Jim Owen's avatar
      Jim Owen
      Copper Contributor
      Thanks Adam, I'll give your suggestions a try and let you know how it goes.
      - Jim

Resources