Friday, 19 April 2013

How to Send Mail with ODI

1.    How to Send Mail


1.1    Main Steps


  • Send Mail with ODI Tool: OdiSendMail
  • Send Multiple Mails with ODI SP

1.1.1    Send Mail with ODI Tools


Parameters descriptions are in the document as below.
Developer’s Guide for Oracle Data Integrator 11g.pdf     P379 A.5.40 OdiSendMail


Send mail in ODI SP with below command.


1.1.2    Send Multiple Mails with ODI SP


1.1.2.1    Generate attachment

  1. Define command on source

C1_USER_ID, C1_USER_NAME and C1_USER_EMAIL are the parameters which can be transferred to command on target.

  1. Define command on target

OdiSqlUnload "-FILE=#sFileExportPath\\ProductList_#C1_USER_ID.csv" "-DRIVER=<%=odiRef.getInfo( "SRC_JAVA_DRIVER" )%>" "-URL=<%=odiRef.getInfo( "SRC_JAVA_URL" )%>" "-USER=<%=odiRef.getInfo( "SRC_USER_NAME" )%>" "-PASS=<%=odiRef.getInfo( "SRC_ENCODED_PASS" )%>" "-FILE_FORMAT=VARIABLE" "-FIELD_SEP=," "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=UTF-8" "-FETCH_SIZE=5000"
Select 'Product Code', 'Product Name' from dual
Union all
select
  Product_Code,
  Product_Name
from Product_Info
Where Seller_ID = '#C1_USER_ID'

#sFileExportPath: ODI variable
#C1_USER_ID: variable defined in command on source

Below are the parameters which can be get from command on source tab.
"-DRIVER=<%=odiRef.getInfo( "SRC_JAVA_DRIVER" )%>" "-URL=<%=odiRef.getInfo( "SRC_JAVA_URL" )%>" "-USER=<%=odiRef.getInfo( "SRC_USER_NAME" )%>" "-PASS=<%=odiRef.getInfo( "SRC_ENCODED_PASS" )%>"

1.1.2.2    Send multiple mail


  1. Define command on source

  1. Define command on target

OdiSendMail "-MAILHOST=#sAdminMailHost" "-FROM=#sAdminFromEmail" "-SUBJECT=Slice data calculated OK!" "-TO=#C1_USER_EMAIL"  "-CC=#sAdminToEmail"  "-ATTACH=#sFileExportPath\\ProductList_#C1_USER_ID.csv"
Hi #C1_USER_NAME,

STG processes finished successfully. Some data was updated.
More details are in the attachment. The files can be opened with Microsoft Excel.

Have a nice day.

STG ODI

#C1_USER_ID and #C1_USER_NAME are the parameters defined in command on source.
#sAdminMailHost, #sAdminFromEmail and #sFileExportPath are ODI variables.


1.2    Reference


Developer’s Guide for Oracle Data Integrator 11g.pdf
P186 Example 12–2 Sending Multiple Emails
P379 A.5.40 OdiSendMail


Send mail in ODI using Gmail Credentials


No comments:

Post a Comment