Пытаюсь отправить письмо при помощи Python. Выдает такую ошибку:
Traceback (most recent call last):
File "/home/user/PycharmProjects/pythonbash_message/copy.py", line 1, in <module>
import smtplib
File "/usr/lib/python3.8/smtplib.py", line 49, in <module>
import email.generator
File "/usr/lib/python3.8/email/generator.py", line 14, in <module>
from copy import deepcopy
File "/home/user/PycharmProjects/pythonbash_message/copy.py", line 3, in <module>
server = smtplib.SMTP('imap.gmail.com', 587)
AttributeError: partially initialized module 'smtplib' has no attribute 'SMTP' (most likely due to a circular import)
Код:
import smtplib
server = smtplib.SMTP('imap.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('cheb0tarev.nikit0s@gmail.com', 'NeScashy')
server.sendmail('cheb0tarev.nikit0s@gmail.com', 'cheb0tarev.nikit0s28092020@gmail.com', 'HalloWorld!')
server.quit()
Traceback (most recent call last):
File "/home/user/PycharmProjects/pythonbash_message/copy.py", line 1, in <module>
import smtplib
File "/usr/lib/python3.8/smtplib.py", line 49, in <module>
import email.generator
File "/usr/lib/python3.8/email/generator.py", line 14, in <module>
from copy import deepcopy
File "/home/user/PycharmProjects/pythonbash_message/copy.py", line 3, in <module>
server = smtplib.SMTP('imap.gmail.com', 587)
AttributeError: partially initialized module 'smtplib' has no attribute 'SMTP' (most likely due to a circular import)
Код:
import smtplib
server = smtplib.SMTP('imap.gmail.com', 587)
server.ehlo()
server.starttls()
server.login('cheb0tarev.nikit0s@gmail.com', 'NeScashy')
server.sendmail('cheb0tarev.nikit0s@gmail.com', 'cheb0tarev.nikit0s28092020@gmail.com', 'HalloWorld!')
server.quit()