2

I'm trying to make a python script that emails me stuff and i followed this tutorial about how to do it and i thought of making it work using SMTP_SSL()

import smtplib, ssl port = 465 password = input("Type your password and press enter: ") context = ssl.create_default_context() sender_email = "[email protected]" receiver_email = "[email protected]" message = """\ Subject: Hi there This message is sent from Python.""" with smtplib.SMTP_SSL("smtp.gmail.com", port, context=context) as server: server.login(receiver_email, password) server.sendmail(sender_email, receiver_email, message) 

But it keeps giving me this error:

ImportError: cannot import name 'SMTP' from partially initialized module 'smtplib' (most likely due to a circular import) 

Can anyone help me clarify what this error means and if there's a workaround for it. Any help appreciated.

0

1 Answer 1

6

I ran into this error too, in my case it was because I named the script email.py.

If anyone face this error in the future, for debugging purposes try using a different filename like my_email_script.py

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.