Brandon
Brandon

Reputation: 483

Importing MIMEMultipart

Everything that I am reading says that email.MIMEMultipart is included in Python's basic library, but when trying to run code that requires it I am getting the message:

ModuleNotFoundError: No module named 'email.MIMEMultipart' 

Is there something simple that I am missing here, or do I not have this module for some reason?

import sys
import time
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

Upvotes: 0

Views: 10493

Answers (1)

jwodder
jwodder

Reputation: 57530

MIMEMultipart is not a module; it is a class in the email.mime.multipart module. To import it, you have to do:

from email.mime.multipart import MIMEMultipart

Upvotes: 4

Related Questions