3

I am getting an error on my second line of code "server = smtplib.SMTP_SSL(host='host_name', port=25)" that reads AttributeError: partially initialized module 'smtplib' has no attribute 'SMTP_SSL' (most likely due to a circular import)

I have the file saved as a .py file so that should not be the issue here.

Thank You,

import smtplib

server = smtplib.SMTP_SSL(host='host_name', port=25)

server.login("your username", "your password")

server.sendmail(
  "email@domain.com", 
  "email@domain.com", 
  "this message is from python")

server.quit()
in0
  • 57
  • 1
  • 2
  • 5
  • 4
    My wager is that you saved this as `smtplib.py`. That is, by definition, a circular import. The `import smtplib` file will reload your file. – Tim Roberts Jul 22 '21 at 21:43
  • 8
    Encountered the same issue, my filename was `email.py` - changed it to something else, and it worked. – Uri Goren Sep 05 '21 at 12:30

0 Answers0