Python SMTP Email Code - Sender Address Rejected - Not Owned By User

June 15, 2022

Introduction

In a normal email sending code from python, I’m getting following error:

File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/smtplib.py", line 901, in sendmail
    raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'<destination-email>': (553, b'5.7.1 <[email protected]>: Sender address rejected: not owned by user <sender>')}

Email Sending Code

Have a look at the How to Send Email from Python Code

Solving the Error

You need to provide the sender email and authentication username same.

Example: Your sender address: [email protected] In Credentials: user: your-email

Note, you are not providing @test.com in credentials. Although, your SMTP server might authenticate well, but this error comes during sending email.

So, your configuration should look like:

address: [email protected]
credential username: [email protected]

And, it will work. Thanks for reading.


Similar Posts

Latest Posts