How to Solve NameError: name 'MIMEText' is not defined -- email

Solution: Import the 'MIMEText' module

To Solve the error, add the following line to the top of your code.

from email.mime.text import MIMEText

 

For more information:
Python email MIMEText