“Relay access denied” means you asked an SMTP server to deliver mail to an outside domain, and it does not trust you to do that. Open relays were abused by spammers for years, so servers relay only for clients that log in or sit on trusted networks. Log in, or use the right server, and the error goes away.
554 5.7.1 <recipient@example.org>: Relay access denied
Microsoft Exchange Online reports the same idea as 5.4.1 Relay Access Denied or 5.7.1 Unable to relay.
What it means
The 554 is “Transaction failed” in RFC 5321, and 5.7.1 is “Delivery not authorized, message refused” in RFC 3463. In Postfix this exact text comes from the reject_unauth_destination restriction. The server accepts mail for domains it hosts from anyone, but for any other destination the client must be in mynetworks or authenticated.
Why it happens
- Your mail app or code does not log in. The SMTP settings have authentication off, so the server sees an anonymous client.
- You are using port 25. Many servers only offer authenticated submission on 587 or 465, and treat port 25 as server to server.
- Wrong server. You pointed your app at the recipient’s mail server, or a server that is not yours, and asked it to send elsewhere.
- Your IP changed. The server trusted your old office IP in
mynetworks, and you now send from somewhere else. - Broken MX on the receiving side. A domain’s MX record points to a server that does not list that domain as accepted, so even normal inbound mail is treated as relaying. Microsoft lists this as a cause of its 5.4.1 and 5.7.1 relay errors.
How to fix it
-
Turn on SMTP authentication in your client or code, and use the same username and password your provider gives you for sending.
-
Use a submission port: 587 with STARTTLS or 465 with implicit TLS. See SMTP ports.
-
Check the host name. It should be your provider’s outgoing SMTP server, not the recipient’s.
-
Running Postfix? For your own users, enable SASL and allow authenticated clients before the reject:
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destinationNever remove
reject_unauth_destinationto “fix” this: that makes you an open relay. -
Receiving domain owner: make the MX record point to a server that accepts mail for the domain, and add the domain to that server’s accepted domains.
-
For app email, use an SMTP relay service or email API with an API key, so you never depend on a mailbox password or office IP. See SMTP relay services.
Which server sent it
- Postfix sends
554 5.7.1 <address>: Relay access deniedby default (the code is set byrelay_domains_reject_code). - Microsoft Exchange Online documents
5.4.1 Relay Access Denied, where the server does not accept mail for the recipient’s domain, and5.7.1 Unable to relay, in its NDR reference. - Google Workspace SMTP relay says
550 5.7.0 Email relay deniedor550 5.7.1 Invalid credentials for relaywhen your IP or domain is not registered in the relay settings. - Gmail and Yahoo inbound do not normally send this: they accept mail for their own users from anyone who passes their checks.
Is it temporary?
No. It is a 5xx permanent refusal, and the server will refuse the same unauthenticated attempt every time. Change your settings, then resend. The recipient address is fine, so do not suppress it because of this error.
How Mailcandor handles it
Mailcandor’s SMTP relay at smtp.mailcandor.com relays to any recipient once you log in with the username mailcandor and an API key as the password, on port 465 or 587. The API needs no SMTP at all. When a message does bounce, the deliverability coach explains it in plain English and hard bounces are suppressed automatically. The free bounce code lookup decodes any reply, the error library covers each code, our SPF, DKIM and DMARC guide handles authentication, and the tools page has more free checks.