Using a Send email script
You can notify recipients about events in pipelines by replacing email commands in your migrated flows with the sendmailWrapper script.
About this task
When you create a pipeline job, you can use the script
/mnts/ds-storage/utilityScripts/sendMailWrapper.sh
in the Bash script node. The
script acts as the mail, mailx, and sendmail commands in your migrated jobs. Before you run a
migrated job, you need to create a volume and a storage volume connection for
ds-storage
. The script is installed to the ds-storage
persistent
volume.
You can also use the sendMailWrapper script in the before-job and
after-job subroutines. Use the /ds-storage/utilityScripts/sendMailWrapper.sh
path
for your script in the Shell command field. For more information on
before/after job subroutines, see Setting up before-job and after-job subroutines in DataStage.
Procedure
Example
sendMailWrapper.sh
command in a Bash script
node:UserVars_MailBody="mail body"
UserVars_MailSubject="mail subject"
UserVars_MailRecipient="abc@mail.com"
echo -e "${UserVars_MailBody}" | /mnts/ds-storage/utilityScripts/sendMailWrapper.sh -s "${UserVars_MailSubject}" ${UserVars_MailRecipient}
echo -e "To: abc@ibm.com\nSubject: Test\nContent-Type: text/html\nMIME-Version: 1.0\n<html><body><pre><b>Test</b><br></pre></body></html>"| /mnts/ds-storage/utilityScripts/sendMailWrapper.sh -t
echo "test mail body" | /mnts/ds-storage/utilityScripts/sendMailWrapper.sh -v -s "Test Mail" abc@xxx.com
Example of the sendMailWrapper.sh
command in a Shell
command:echo "mail body" | /ds-storage/utilityScripts/sendMailWrapper.sh -a /mnts/attachement1.txt -s "subject" support@ibm.com