Deliverability

554 5.7.1 Relay access denied: fix SMTP relay and auth errors

"554 5.7.1 Relay access denied" means the server refused to forward your message to a domain it doesn't host, usually because your client didn't authenticate. Turn on SMTP authentication, use port 587 (STARTTLS) or 465 (implicit TLS), and send through your provider's server. If the recipient's server said it, their admin has to fix it.

Sohail HussainSohail Hussain11 min read

Short answer

  • Open the bounce and find which server said no. If it is your own outgoing server, turn on SMTP authentication, log in with the full address and password, and connect on port 587 (STARTTLS) or 465 (implicit TLS).
  • If the rejecting server belongs to the recipient, you cannot fix it. Retry later, then send the full bounce to their admin.

You hit send and the message came back with 554 5.7.1: Relay access denied or 530 5.7.1 Authentication required. Both mean a mail server refused to pass your message along. Which server refused decides who has to fix it, and the bounce usually tells you.

Why it happens

An SMTP server accepts a message in two cases. Either the recipient is on a domain it hosts, or the sender is someone it trusts, in which case it relays the message anywhere. If neither is true, it refuses with a 5.7.1 policy error. Microsoft's documentation describes the Exchange form of this ("Unable to relay") as a sending system that isn't allowed to send to a system that isn't the message's final destination (Microsoft Learn).

The usual causes, most common first:

  1. Your client, script, printer or form never logged in. The server saw an anonymous sender with an outside recipient.
  2. Wrong host, port or security mode, so authentication never happens.
  3. An on-premises Exchange server where the sending app isn't allowed to relay. Microsoft's Q&A answers say the default Frontend connector only accepts mail for your accepted domains (Microsoft Q&A).
  4. The recipient's side doesn't recognize its own domain. Microsoft lists an MX record pointing at a system that doesn't accept that domain as a common cause (Microsoft Learn).
  5. A sender address the server won't let you use, or an IP on a blocklist. These are less common.

The reply breaks down like this:

PartMeaning
554Permanent failure; resending the same message unchanged won't help
5.7.1Enhanced status code for security or policy: not authorized
530 5.7.1Variant where the server says authentication must come first
Relay access deniedFree text; wording differs between Exchange, Postfix, Purelymail and others

Microsoft documents a separate variant, "Client was not authenticated". It means the receiving system requires authentication before accepting a message and the sender didn't provide it (Microsoft Learn).

Step 1: Work out which server rejected you

Open the non-delivery report and find the reporting server. In Exchange NDRs, look under Diagnostic information for administrators, which names the server that generated the report and the server that rejected the message (Microsoft Learn). To read raw headers, paste them into the email header analyzer.

  • It names your own outgoing server or provider: go to Steps 2 to 4.
  • It names the recipient's MX host or a gateway in front of their domain: go to the recipient-side section.

A quick test also helps. If every external recipient fails at once but mail to your own domain works, you are almost certainly looking at an authentication problem on the sending side.

Step 2: Turn on SMTP authentication

This is the fix for most people, especially with a new mail client, a website contact form, a scanner or a script.

  1. Open the account's outgoing server (SMTP) settings.
  2. Enable the option that says the outgoing server requires authentication. In classic Outlook this is on the Outgoing Server tab as "My outgoing server (SMTP) requires authentication", reached via File > Account Settings > More Settings.
  3. Use the full email address as the username, unless your provider says otherwise.
  4. Enter the mailbox password, or an app password if the account uses two-factor authentication or the provider has disabled basic passwords.
  5. Send a test to an outside address.

People in Microsoft's community threads report that this box sometimes ends up unchecked after an update or profile repair. In one thread the poster ticked it again and the error cleared.

For a script, the SMTP library must log in before it sends. In Python, call login() after starttls():

import smtplib

with smtplib.SMTP("smtp.example.com", 587) as server:
    server.starttls()
    server.login("you@example.com", "your-password")
    server.sendmail("you@example.com", ["them@example.net"], message)

A script that skips login() and talks to a server that refuses open relay gets exactly this error.

Step 3: Fix the port and security mode

Authentication belongs on the submission ports. Port 25 is for server-to-server delivery, and many providers block it or won't accept login there.

PortSecurityUse it for
587STARTTLS (upgrade after connecting)Default for clients and scripts
465Implicit TLS (encrypted from the start)Submission when your provider documents it
25None or opportunisticServer-to-server only

Microsoft's community answers suggest trying 465 with SSL first and then 587 with TLS/STARTTLS if the test fails. Mismatching the two, such as 587 with "SSL/TLS" or 465 with "STARTTLS", usually hangs or errors. Copy the exact host name, port and mode from your provider's help page. SSL/TLS for email and SMTP encryption covers how the modes differ.

Do not open relay to fix this

Allowing anonymous relay for your whole network or for any IP is the quickest way to get an Exchange or Postfix server abused and blocklisted. Authenticate the sender, or scope relay to named IP addresses.

Step 4: Allow a specific app to relay through your own Exchange server

If an application, copier or line-of-business server sends through your on-premises Exchange and gets this error, the sender is probably connecting anonymously to a connector that doesn't allow relay. You have two safe options.

  1. Authenticate the app with a mailbox account on a client submission port, as in Step 2.
  2. Create a dedicated Receive connector for anonymous relay and scope it to the app's IP. Microsoft's Q&A guidance says to remove the default remote range and add only the addresses you want to allow (Microsoft Q&A). The same answers warn against adding whole subnets that contain other Exchange servers, since that can cause server-to-server problems (Microsoft Q&A).

Answers in Microsoft's threads advise against editing the default receive connectors. Adding the accept-any-recipient permission to the default Frontend connector can turn the server into an open relay (Microsoft Q&A). Exact steps differ by Exchange version and by on-premises versus Exchange Online, so follow Microsoft's page on allowing anonymous relay on Exchange servers.

If your environment is hybrid, one Microsoft Q&A answer suggests checking the accepted domain type on both sides: Internal relay in Exchange Online and Authoritative on-premises (Microsoft Q&A).

Step 5: Check the sender address

Some servers reject authenticated mail when the From address isn't the logged-in mailbox or an address the account may send as. If you changed the From address recently, switch back to the authenticated mailbox, or add the other address as an alias or verified sender in your provider's settings.

When the error comes from the recipient's side

If your own provider accepted the message and the recipient's server rejected it, you cannot repair this yourself. The typical story is a gateway or filter, or a mail server that doesn't treat its own domain as local. Microsoft's guidance for the case where a domain's MX points at a system that doesn't accept it is that the domain's administrator must fix the MX record, the accepted-domain setup, or both (Microsoft Learn). The same error appears when someone has just moved their mail to a new provider, or has an incomplete domain setup in Microsoft 365.

Some of these clear on their own. In one Microsoft Q&A thread, the person reported the bounces stopped about five hours later with no changes on their end.

What you can do:

  1. Retry once or twice over an hour or two.
  2. Try another known address at the same domain. If only one fails, the mailbox may have been renamed or removed.
  3. Reach the person another way and ask them to forward the bounce to their IT admin.
  4. Send the admin the full bounce, the time with time zone, your sender address and the rejecting server name.

A 5xx is a permanent failure (see hard bounce), so don't resend in a loop.

Blocklists can look similar

Microsoft's community answers also list an IP on a real-time blocklist as a possible cause. If the bounce text names a blocklist or the problem follows one IP address, check that separately from authentication.

Cause, symptom and fix at a glance

What you seeLikely causeFix
Instant failure to every external addressSMTP auth off, or wrong portSteps 2 and 3
530 5.7.1 Authentication requiredServer wants login firstEnable authentication
Works in your mail app, fails from a script, printer or formThat sender is anonymous or not allowed to relayAuthenticate it, or scope a relay connector (Step 4)
Bounce names the recipient's serverRecipient-side filter or domain setupRetry, then contact their admin
One recipient domain onlyUsually the recipient sideContact their admin
Started after a password changeStale saved password, or basic auth disabledUpdate credentials; use an app password

Checklist before you try again

  • The SMTP server is your provider's outgoing host, not an old one.
  • Outgoing authentication is on, with the full address as username.
  • The password is current, or an app password if required.
  • Port 587 with STARTTLS or port 465 with implicit TLS, matched correctly.
  • The From address is the authenticated mailbox or a permitted alias.
  • On your own Exchange server, relay is limited to named IPs or authenticated users.

If nothing works

Contact your mail provider's support if the rejecting server is yours. Contact the recipient's administrator if it is theirs. Mailbox providers such as Purelymail publish a support article for this exact error, and Microsoft documents its 5.7.1 variants in its Exchange Online NDR reference.

Include the full bounce text, the time with time zone, the sender and recipient addresses, the host and port you connect to, and what you already tried.

Subject: 554 5.7.1 Relay access denied when sending to {recipient-domain}

Hello,

Messages from {sender@your-domain} to {recipient@their-domain} bounce with:
554 5.7.1: Relay access denied

Time of attempt: {date, time, time zone}
Rejecting server (from the bounce): {server name}
Outgoing server and port I use: {host}:{port}, {STARTTLS or SSL/TLS}
SMTP authentication: {enabled or not}

I have already checked authentication, port and security mode. The full
bounce message is attached. Could you confirm whether relay or accepted
domain settings need to change?

Thank you

Where Mailneo fits

This error sits between you and a mail server, so Mailneo can't change its cause. Mailneo sends through accounts you connect, including custom SMTP, and you can test a connection from the app. If the test fails with this error, run through the steps above; see the email accounts documentation. Mailneo can't change a server's relay rules or fix a recipient's filter.

Common questions

Is "554 5.7.1 Relay access denied" my fault or the recipient's?

It depends on which server is named in the bounce. If it is your outgoing server, authentication or port is the likely cause. If it is the recipient's server, their configuration is at fault.

Why can I send to colleagues but not to outside addresses?

Mail to your own domain is inbound to a server that hosts it, so no relay is needed. Mail to outside domains needs the server to relay for you, which it only does for authenticated or explicitly allowed senders.

Does an app password fix it?

Only if the account uses two-factor authentication or the provider has disabled basic passwords. In those cases the normal password fails login, so the server treats you as unauthenticated.

Should I allow anonymous relay for my printer?

Prefer authenticating it. If you must use anonymous relay, create a dedicated connector limited to the printer's IP rather than loosening the default connector.

deliverabilityexchangepurelymailerror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

Deliverability

0x800ccc0e: Outlook Unable to Connect to SMTP Server, Fixed

Outlook error 0x800ccc0e means the app could not open a connection to your outgoing (SMTP) server. Usually the port, encryption setting or password is wrong, or antivirus, a firewall or your ISP is blocking it. Set port 587 with STARTTLS, turn on SMTP authentication, and test again.

Sohail Hussain|10 min read
Deliverability

SocketLabs "421 4.5.1 Too many errors" blacklist: how to fix it

`421 4.5.1 Too many errors, you have been temporarily blacklisted` means a SocketLabs server saw repeated auth or bad-address errors from your IP and paused it. Stop whatever is retrying, fix credentials and invalid recipients, clear the queue, and wait. The block usually lifts within minutes, but returns if retries resume.

Sohail Hussain|9 min read
Deliverability

421-4.7.0 Gmail Has Detected This Message Is Suspicious: Fix

The 421-4.7.0 "suspicious due to the nature of the content and/or the links" error means Gmail's content filter rejected your message after DATA, not an authentication check. Remove click tracking or move it to your own domain, drop URL shorteners, check link reputation, then retest with a plain message.

Sohail Hussain|10 min read
Deliverability

421 4.7.0 IP not in whitelist for RCPT domain: what it means

The error 421 4.7.0 IP not in whitelist for RCPT domain means the recipient's mail gateway, usually Mimecast in reports, only accepts connections from approved IPs, and the Google sending IP isn't on that list. The fix is on the recipient side: their admin must allow the IPs or change the mail routing.

Sohail Hussain|9 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free