Python Email

09-18-2018 12:08 PM
New Contributor II

I am stuck at this script for the last 2 weeks. I am getting error as soon I moved this script to AGS (ArcGIS Sever 10.3).

I am using python v2.7.8. error result


C:\Temp >

Traceback (most recent call last):

  File "C:\Temp\\", line 27, in <module>


  File "E:\ArcGIS10.3\lib\", line 637, in starttls

    raise SMTPException("STARTTLS extension not supported by server.")

# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Created on: 2018-02-20
# Description:
# ---------------------------------------------------------------------------

# Import smtplib for the actual sending function
import smtplib

# Import the email modules we'll need
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

fromaddr = ""
toaddr = ""
msg = MIMEMultipart()
msg['From'] = fromaddr
msg['To'] = toaddr
msg['Subject'] = "The contents of " + "more details"
body = "Email body message - more details to be added "
msg.attach(MIMEText(body, 'plain'))

server = smtplib.SMTP('server name', port)
#server.login("youremailusername", "password")
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
0 Kudos
1 Reply
MVP Esteemed Contributor

I am getting error as soon I moved this script to AGS (ArcGIS Sever 10.3).

You moved the script to ArcGIS Server 10.3 from where?  Another ArcGIS Server machine?  An ArcGIS Desktop machine?

Since this error is directly, and only, related to smtplib, I suggest you search the web (Stack Exchange/Overflow) for suggestions on resolving it.

0 Kudos