AnsweredAssumed Answered

How to install email python module in ArcGIS Pro environment to use with Python 3.x?

Question asked by paul.haakma on Oct 6, 2017
Latest reply on Oct 7, 2017 by paul.haakma

Hi all

 

I have a script that I used for sending emails from ArcMap using python 2.x. It uses all the import statements below. When I try to use the same script in ArcGIS Pro as a script (using python 3.x), it says: ImportError: No module named 'email.MIMEMultipart'.

 

Using the 'package manager' in ArcGIS Pro itself, I can't see any module called 'email' that I can import. Can anyone tell me how I can add that module to the ArcGIS Pro python environment, or whether I need to find some way to re-write my script without that module. Or can anyone suggest an alternate module that can do the same tasks?

 

 

import arcpy
import smtplib, os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
from email.Utils import COMMASPACE, formatdate
from email import Encoders
import ConfigParser

 

msg = MIMEMultipart('mixed')

msg['From'] = send_from
msg['To'] = send_to if isinstance(send_to, basestring) else COMMASPACE.join(send_to)

 

etc etc...

 

cheers

-Paul

Outcomes