Relay Access Denied 5.7.64 Tenant Attribution

New Contributor

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 []"

The original host name we connect to is  [domain] 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++)




            //Retrieve the MailMessage object

            MailMessage mail = (MailMessage)mailArray[i];



        catch (System.Exception e)







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




2 Replies

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.


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.



Thanks Adam, I'll give your suggestions a try and let you know how it goes.
- Jim