Showing posts with label Advanced topics in ODI. Show all posts
Showing posts with label Advanced topics in ODI. Show all posts

Monday, 21 April 2014

Sending Mail in ODI 11g

How to send an E-mail through ODI?

                  Let us see how to send emails using Jython Scripts in ODI.
       
                 We knows very well that ODI has the lot of technologies and it is the best ELT tool available right now.

Follow the steps given below

1. Create an ODI Procedure and use the Technology as Jython.

2. Create a command within the ODI Procedure. Name : Sending Email's Through ODI

3. Double click on the command and use the following code in the target command

import smtplib
import string
BODY = string.join((
"From: %s" % 'SENDER_EMAIL_ID',
"To: %s" % 'RECEPIENT_EMAIL_ID',
"Subject: %s" % 'Awesome Note From ODI....',
"",'Hi, This is a Test Email from ODI... Put your Auditing logic bla bla bla here.....'
), "\r\n")
sender = smtplib.SMTP('smtp.gmail.com',587)
sender.set_debuglevel(1)
sender.ehlo()
sender.starttls()
sender.ehlo()
sender.login('USERNAME', 'PASSWORD')
sender.sendmail('SENDER_EMAIL_ID',['RECEPIENT_EMAIL_ID'],BODY)
sender.close()

MAKE SURE THAT YOU WILL BE REPLACING ALL THE VALUES IN BOLD AS PER WHAT YOU HAVE...


4. Now execute the procedure
5.Go to the operator navigator and check for the session status.




Now you are done and Successfully sent the mail using ODI :) Check your inbox :)