AnsweredAssumed Answered

Sending Email from Python

Question asked by MCusumano on Jul 17, 2012
Latest reply on Jul 20, 2012 by MCusumano
I am trying to get this to work:

import smtplib
from smtplib import SMTP_SSL as SMTP
import datetime

HOST = "xxxxxxxx.enterprise.xxxx.com"
PORT = 25
FROM = "xxxx.xxxxxxxx@xxxx.com"
TO = ["xxxx.xxxxxxxxx@xxxx.com"]
SUBJECT = "Test"
BODY = "Success"

BODY = BODY + "!"

smtp = smtplib.SMTP(HOST,PORT)
smtp.connect(HOST, PORT)
smtp.login("xxxxxx\xxxxx", "xxxxx")
smtp.ehlo()
smtp.sendmail(FROM,TO,body)
smtp.quit()


server.set_debuglevel(0)


But I keep getting the following error:

[Errno 10054] An existing connection was forcibly closed by the remote host

Can't see anything obvious I'm doing wrong. Any ideas? Thanks.

Outcomes