sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #26363
Re: [Question #241177]: How to send a email on detecting a image in sikuli IDE ?
Question #241177 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/241177
Ador Juan Cruz posted a new comment:
I also am trying to send an email. Code is very similar to op.
However I know for a fact that the send_email code I have works on python but using the same code it does not work on sikuliX (jython)
I was wondering if someone has some insights on how to make it work on sikuliX
#***************************************************************************
#The code works on python 2.7 on windows. I debugged and tested it by running pyScripter for windows.
#(note: replace the TO, from, gmail user and password)
import time
import smtplib
def send_email(mySubject, myMsg):
gmail_user ="user@xxxxxxxxx"
gmail_pwd = "password"
FROM = 'user@xxxxxxxxx'
TO = ['user2@xxxxxxxxx'] #must be a list
timeStr = time.strftime("%Y-%m-%d %H:%M:%S")
SUBJECT = timeStr + mySubject
TEXT = myMsg + "\r\n" + timeStr
# Prepare actual message
message = """\From: %s\nTo: %s\nSubject: %s\n\n%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
try:
server = smtplib.SMTP_SSL()
server.connect('smtp.gmail.com', 465)
server.login(gmail_user, gmail_pwd)
server.sendmail(FROM, TO, message)
server.quit()
print 'successfully sent the mail'
except:
print "failed to send mail"
send_email("This is the subject", "Hello World")
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.