I have included the screenshot of output. Please help me solve this issue.
input
import smtplib
conn = smtplib.SMTP('imap.gmail.com',587)
conn.ehlo()
conn.starttls()
conn.login('example@gmail.com', 'password')
conn.sendmail('example@gmail.com','emaple2@gmail.com','Subject: What you like? \n\n Reply Reply Reply')
conn.quit()
output
Traceback (most recent call last):
File "E:\python\openCV\email.py", line 3, in <module>
import smtplib
File "C:\Users\loges\AppData\Local\Programs\Python\Python36\lib\smtplib.py", line 47, in <module>
import email.utils
File "E:\python\openCV\email.py", line 4, in <module>
conn = smtplib.SMTP('imap.gmail.com',587)
AttributeError: module 'smtplib' has no attribute 'SMTP'
Your file is called email.py
. A standard Python library module with the same name is used by smtplib
. As a result, smtplib
imports your file instead of the standard module. Solution: rename your file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.