454 4.7.1 Relay Access Denied: Causes, Solutions, and How to Fix It

Alaa
By Alaa
SMTPedia documents email infrastructure end to end: SMTP standards from the RFC archive, delivera...
2 min read Jun 21, 2026 85 views
TRANSIENT FAILURE · X.7.x SECURITYFIX YOUR RELAY

SMTP response received

454 4.7.1 Relay Access Denied: Causes, Solutions, and How to Fix It

You received this code because your outbound SMTP server refused to forward the message. This is a sender-side infrastructure problem, not a recipient issue. Almost always caused by missing SMTP AUTH, the wrong outbound server, an IP not on the relay allowlist, or a domain not in Accepted Domains (Exchange). Fixable in minutes once you identify which.

๐Ÿ‘ค Who sees this code

  • Developer configuring transactional email in an application
  • Sysadmin setting up Postfix, Exim, or Exchange relay
  • Team migrating to a new outbound SMTP provider

๐Ÿ”ง What this guide fixes

  • Distinguish sender-side relay-denied from receiver-side rejection
  • Correct SMTP AUTH, port, TLS, or Accepted Domains configuration
  • Provider-specific fixes for Postfix, Exchange, Sendmail, and modern ESPs

โšก Do these 3 things first (before diving deeper)

1

Confirm SMTP AUTH is enabled and credentials are valid

Most relay refusals happen because the client is not authenticating before RCPT TO. Confirm SMTP AUTH is turned on in your library config, the username matches an active account, and the password is current. Test manually with openssl s_client or swaks. If AUTH fails at handshake, relaying will always be denied regardless of other config.

2

Verify the outbound SMTP server hostname is correct

Your app might be pointing at an MX server (used for receiving) or an old provider hostname that has since changed. Confirm the outbound hostname matches what your CURRENT provider documents. Public MX records do not accept outbound relay from applications. Providers occasionally deprecate old outbound hostnames without loud warning.

3

Check the port and TLS mode you are connecting on

Modern SMTP relays require port 587 with STARTTLS for authenticated submission, or port 465 with implicit TLS for legacy compatibility. Port 25 is server-to-server relay only and typically refuses AUTH. If your app is on port 25 and getting 454 4.7.1, switch to 587 with STARTTLS.

Common causes of 454 4.7.1

  1. SMTP authentication not enabled in the sending application. The single most common cause. Your application is trying to relay through an authenticated SMTP server without providing AUTH credentials. Modern relays never allow unauthenticated relay by default because open relays get instantly abused for spam. Enable SMTP AUTH in your library configuration and provide valid credentials.
  2. Connecting to the wrong outbound SMTP server. Some setups mistakenly point outbound SMTP at an MX server or a public relay that is not authorized for your traffic. Confirm you are connecting to the outbound submission server documented by your current email provider (smtp.gmail.com, smtp.office365.com, smtp.sendgrid.net, etc.). Using an MX server as an outbound relay is a persistent misconfiguration.
  3. Sending IP not in the relay allowlist. For self-hosted Postfix, Exim, or Sendmail, unauthenticated relay is permitted only for IPs listed in mynetworks (Postfix) or equivalent trusted-host configurations. If your application server sends unauthenticated from a new IP that was never allowlisted, the relay rejects with 454 4.7.1. This surfaces after infrastructure moves or firewall changes.
  4. Expired or rotated SMTP credentials. Passwords rotate. API keys expire. Service accounts get disabled during quarterly access reviews. Your application keeps sending with stale credentials, gets 454 4.7.1 as the relay refuses the AUTH handshake, and you spend an hour debugging routing before checking credentials. Verify credentials first: it takes seconds and eliminates the most common trivial cause.
  5. Sending domain not in Accepted Domains (Exchange). For self-hosted Exchange or hybrid Microsoft 365, mail can only be relayed for domains explicitly listed in Accepted Domains. If your organization added a new subdomain or acquired a domain without updating Exchange, sends from that domain hit 454 4.7.1 or 550 5.7.54. Add the domain via Exchange Admin Center or PowerShell.

How to fix 454 4.7.1, step by step

  1. Enable SMTP authentication in your sending application. In most mail libraries (nodemailer, smtplib, PHPMailer, Mail::Sender), SMTP AUTH is a simple flag: pass a username and password to the constructor and set secure to true for TLS. For custom code, implement the AUTH LOGIN exchange after EHLO. Add SMTP debug logging temporarily to confirm AUTH commands appear before MAIL FROM in the wire trace.
  2. Use port 587 with STARTTLS as your submission port. Port 587 is the RFC 6409 designated submission port for authenticated SMTP. Configure your app to connect on 587, negotiate STARTTLS, then authenticate. Port 465 with implicit TLS is a legacy alternative some providers still support. Port 25 is for server-to-server relay and most modern ISPs block outbound port 25 entirely.
  3. Verify credentials directly against the relay before touching app code. Prove credentials work by connecting manually with openssl s_client -starttls smtp -connect smtp.example.com:587 or swaks. Run the AUTH LOGIN handshake with your username and password. If manual fails, the credentials are the problem: reset password or regenerate the API key. If manual works but app fails, your app config or library is misconfigured.
  4. Add your sending IP to the relay allowlist (self-hosted only). For Postfix, add the IP to mynetworks in main.cf and reload. For Exim, update hosts_allow_relay. For self-hosted Exchange, add the IP to the receive connector Remote Network Settings. Only allowlist IPs you fully control and trust: allowlisting shared or dynamic IPs turns your server into an open relay.
  5. Update the outbound hostname if you migrated providers. Configurations drift after ESP or domain migrations. Confirm the outbound hostname matches your current provider documentation, not tribal knowledge from years ago. Providers deprecate old hostnames without prominent warning. If your app has been sending for years unchanged, the hostname might have been quietly retired.
  6. Consider switching to a dedicated SMTP relay service. Managed services (SendGrid, Mailgun, Amazon SES, Postmark) handle relay configuration, authentication, ports, and TLS entirely. You call the API or SMTP endpoint with a key, they handle everything downstream. This eliminates the whole class of 454 4.7.1 errors caused by self-hosted misconfiguration, typically at costs below the developer time to maintain your own relay.

๐ŸŒ How each provider sends this exact code

Provider
Exact response
Likely cause
Postfix
550 5.7.1 <user@domain>: Relay access denied
IP not in mynetworks, no SMTP AUTH
Exchange 2016+
550 5.7.1 Client does not have permissions to send as this sender
Sender domain not in Accepted Domains
Sendmail
550 5.7.1 ... Relaying denied
Access DB blocking or no AUTH
Gmail SMTP relay
550 5.7.1 Invalid credentials for relay
Wrong app password or 2FA required

โš– How this code differs from adjacent ones

Code
Real meaning
Action
554 5.7.1
Permanent relay access denied variant
Same fix, deeper failure
454 4.7.1
Transient relay access denied
Retry after fixing AUTH
550 5.7.54
Unable to relay in non-accepted domain (Exchange)
Add domain to Accepted Domains

Prevention going forward

Once relaying-denied is fixed, keep it fixed with configuration discipline that catches drift before it produces outbound outages.

  • Document your outbound SMTP configuration in one authoritative place. When credentials rotate or provider settings change, apps break silently unless a single source of truth tells every service what to use.
  • Rotate SMTP credentials on a schedule you control, not on emergency. Sudden rotation across dozens of apps causes 454 4.7.1 storms because updates lag deployments.
  • Prefer authenticated ESP submissions over self-hosted relay wherever operationally viable. Managed services handle the entire class of relay-configuration complexity that produces 454 4.7.1.
  • Test outbound sends immediately after any infrastructure change. A new container image, a firewall rule, or a security patch can shift outbound behavior in ways that only surface as 454 4.7.1 the next time your app tries to send.
  • Monitor authentication failure rates on your relay server. A spike in AUTH failures precedes 454 4.7.1 storms by minutes to hours, giving you time to fix credentials or config before customers notice missing emails.

Frequently asked questions about 454 4.7.1

Is this relay-denied 454 4.7.1 the same as the 454 4.7.1 from Gmail or Outlook?
No, and this is one of the most confusing aspects of SMTP status codes. Both use the same numeric code because the RFC uses it for the general policy-and-security failure class. But the cause is completely different: relay-denied is a sender-side problem (your outbound relay refuses your request โ€” see our 550 5.7.1 Relaying denied hand-crafted deep-dive), while Gmail/Outlook rejections are receiver-side (their inbound filter refuses your message โ€” see our 550 5.4.1 Office 365 guide for Microsoft-specific policy). The diagnostic text tells you which.
Why do I need SMTP AUTH now when my app worked without it before?
Something changed. Either credentials expired, the outbound server updated to disallow unauthenticated relay, or you moved to a different sending IP. Modern relays never permit unauthenticated relay from the general internet. Whatever the previous config was, enable SMTP AUTH now: it is the only durable answer.
Should I use port 25, 465, or 587?
Port 587 with STARTTLS is the RFC 6409 designated submission port and the recommended default. Port 465 with implicit TLS is a legacy alternative supported by some providers. Port 25 is for server-to-server relay only: most providers refuse AUTH on 25 and many ISPs block outbound 25 entirely. If your app is on 25 and getting relay-denied, move to 587.
Can I fix relaying denied without changing my code?
Sometimes. If the cause is credentials rotation, updating the secret store is enough. If the cause is missing IP allowlist, adding the IP to mynetworks or receive connector is enough. If the cause is missing SMTP AUTH in the app, you need to change the code or the library config. Try credentials and allowlist first, then dig into code.
What is the difference between "relaying denied" and "recipient address rejected"?
"Relaying denied" means your outbound server refused to accept the message: you never got past your own infrastructure. "Recipient address rejected" means your outbound sent successfully but the receiving server refused. Different points in the SMTP conversation, different debugging paths. Relay-denied is fixed on your side. Recipient-rejected requires investigating receiver rules.
Should I switch to a dedicated SMTP service?
For most applications, yes. Managed services abstract away the entire class of 454 4.7.1 errors: you get an API key, call the endpoint, they handle authentication, delivery, retries, and reputation. Typically cheaper than developer time maintaining a self-hosted relay, and dramatically more reliable at scale. Self-hosted only makes sense with specific compliance requirements.

Stop 454 4.7.1 bounces before they happen.

SMTPing catches invalid addresses, disposables, catch-all traps, role accounts and dead mailboxes before you send. Fewer bounces means less firefighting and a healthier sender reputation. 13 validation types, 25 free daily, no card required.

Try SMTPing free โ†’

About the Author

Alaa - SMTPedia author

Alaa ยท LinkedIn

Email infrastructure specialist with 8+ years of hands-on experience in SMTP, deliverability, and email verification. Iโ€™ve configured and troubleshot mail systems across Postfix, Exchange, and cloud relays, managed IP reputation and warmup campaigns, and built verification pipelines processing millions of addresses. My work spans DNS authentication (SPF, DKIM, DMARC, BIMI), bounce handling, blocklist monitoring, and compliance frameworks including CAN-SPAM and GDPR. I write every article on SMTPedia to give email professionals, developers, and marketers the accurate, RFC-grounded reference they need.


About SMTPedia

SMTPedia is an independent email industry reference covering SMTP, IMAP, POP3, email deliverability, marketing platforms, DNS authentication, and email verification. Every article is researched from official provider documentation, IETF RFCs, and industry best practices. Settings and configurations are verified quarterly.

We are cited as a source by ChatGPT, Microsoft Copilot, and thousands of email professionals worldwide. Learn more about our editorial process.