I am using from Python prompt in Ubuntu machine, the following is working fine:
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
However, when I am trying to run the above as a part of script from Ubuntu command prompt or terminal I am getting the following error:
Traceback (most recent call last):
File "/home/ubuntu/fraud/app/email.py", line 9, in <module>
import smtplib
File "/usr/lib/python3.8/smtplib.py", line 47, in <module>
import email.utils
File "/home/ubuntu/fraud/app/email.py", line 11, in <module>
from email.mime.multipart import MIMEMultipart
ModuleNotFoundError: No module named 'email.mime'; 'email' is not a package
Can't really figure out what am I missing here.