I am writing a simple sendmail function to myself and I keep getting this error:
NameError: name \'SMTPException\' is not defined
What is wrong with my code? Any
In Python, you will need to fully qualify the name by prefixing it with its module:
except smtplib.SMTPException:
This is true unless you specifically import the unqualified name (but I wouldn't recommend doing this for your program, just showing what's possible):
from smtplib import SMTPException