Lesson 14 email

I am getting this error message when I try and send email with the lesson 14 example. Any ideas why? Im Python 3.7 with Pycharm CE

No module named ‘email.mime’; ‘email’ is not a package.

This is the example in the lesson:
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib

I figured this one out in case anyone else makes a rookie mistake like me. I was naming my files so I could go back and review them when I started building something real, so I had named the email lesson email.py. I guess by naming the file that, I broke how the default import worked. I did the same thing with datetime as well, which is how I figured it out.

I am using Vscode, and I got an error also, I am using app.py just like Mosh. I got the same error with the next topic which is templates.

this is my code below

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib

message = MIMEMultipart()
message[“from”] = “Philip Awo”
message[“to”] = “phildudex@gmail.com
message[“subject”] = “This is a test”
message.attach(MIMEText(“Body”))

with smtplib.SMTP(host=“smtp.gmail.com”, port=587) as smtp:
smtp.ehlo()
smtp.starttls()
smtp.login(“philipawoseyila@gmail.com”, “blahblahblah”)
smtp.send_message(message)
print(“sent…”)