Wednesday, 26 February 2014

Send mail using Jython Script using Procedure in ODI

import smtplib
import string
BODY = string.join((
"From: %s" % 'senderemailaddress@gmail.com',
"To: %s" % 'recipientemailaddress@gmail.com',
"Subject: %s" % 'Test Mail',
"",'This is a test email from ODI'
), "\r\n")
sender = smtplib.SMTP('smtp.gmail.com',587)
sender.set_debuglevel(1)
sender.ehlo()
sender.starttls()
sender.ehlo()
sender.login('senderusername', 'senderpassword')
sender.sendmail('senderemailaddress',['recipientemailaddress'],BODY)
sender.close()

No comments:

Post a Comment