R
R
rosh1k2022-02-17 22:26:23
Python
rosh1k, 2022-02-17 22:26:23

AttributeError: module 'smtplib' has no attribute 'SMPT' how to solve?

I can't find a solution to this error, please help!
The code is like this, I’ll say right away that I found it in a training video:

import smtplib



def send_email(message):
  sender = "[email protected]"
  password = "скрыто"


  server = smtplib.SMPT("smpt.gmail.com", 587)
  server.starttls()

  try:
    server.login(sender, password)
    server.sendmail(sender, sender, message)

    return "yess sirr"
  except Exception as _ex:
    return f"{_ex}\n Check ur login or password"

 
def main():
  message = input('Ввод сообщения:')
  print(send_email(message = message))

if __name__ == '__main__':
  main()

The error is like this:
Traceback (most recent call last):                          
  File "D:\!all\rm\sadasdfdf.py", line 28, in <module>      
    main()                                                  
  File "D:\!all\rm\sadasdfdf.py", line 25, in main          
    print(send_email(message = message))                    
  File "D:\!all\rm\sadasdfdf.py", line 11, in send_email    
    server = smtplib.SMPT("smpt.gmail.com", 587)            
AttributeError: module 'smtplib' has no attribute 'SMPT'

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-02-17
@rosh1k

SMPT vs SMTP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question