import smtplib
def send_email(message):
sender = "*"
password = "*"
server = smtplib.SMTP("smpt.gmail.com", 587)
server.starttls()
try:
server.login(sender, password)
server.sendmail(sender, sender, message)
return 'The message was send successfully!'
except Exception as _ex:
return f"{_ex}\nCheck your login or password!"
def main():
message = input('Type your message: ')
print(send_email(message=message))
if __name__ == "__main__":
main()
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\Telegram\email.py", line 1, in <module>
import smtplib
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 47, in <module>
import email.utils
ModuleNotFoundError: No module named 'email.utils'; 'email' is not a package
В переменных sender = и password = стоит почта и пароль