Python smtplib.SMTPRecipientsRefused: {'user@example.org': (550, b'5.7.1 Relaying denied')}
The SMTP server refused all recipients, and smtplib raised the aggregated error.
SMTPRecipientsRefused: {'a@b.com': (550, b'5.7.1 Relaying denied')}smtplib.SMTPRecipientsRefused: {'user@example.org': (550, b'5.1.1 user unknown')}SMTPRecipientsRefused Python sendmail(550, b'Relay access denied') Meaning
The dict shows each recipient with the server's code and message. Typical causes: relay denied (need authentication), unknown user, recipient domain blocked, or sender policy. Authenticate with login(), use valid recipients, and for sandbox/relay services verify recipients.
Common causes
- Not authenticated, relay denied
- Invalid/unknown recipients
- Provider sandbox/unverified recipients
- Policy or blocklist rejection
- Typos in addresses
⚡ Quick fix
- Authenticate (
server.login(...)) beforesendmail - Check each recipient's code in the exception dict
- Verify recipients in sandbox accounts
Detailed fix by platform
Python
- python
try: server.sendmail(sender, recipients, msg.as_string()) except smtplib.SMTPRecipientsRefused as e: print(e.recipients) # {addr: (code, message)}
How to diagnose
- Code — Per recipient?
- Auth — Done?
- Sandbox — Unverified?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Email / SMTP
- Laravel: Connection could not be established with host Laravel: Symfony\Component\Mailer\Exception\TransportException: Connection could not be established with host "smtp.mailtrap.io:2525": stream_socket_client(): Unable to connect
- SES: Maximum sending rate exceeded Amazon SES: Throttling — Maximum sending rate exceeded (454 Throttling failure)
- self-signed certificate (SMTP TLS) Nodemailer: Error: self signed certificate in certificate chain (code: 'ESOCKET') / unable to verify the first certificate
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 18 Nov 2026