I have a file which have in every row email recipient,header and body . So the structure is like that:
receipient|header|body
[email protected],Alertheader,CheckYourData
[email protected],GreenLight,GoWithYourProcess
I would like to write a script which process every row and send an email to each person with header and body.
Please keep in mind that i am writing it on Informatica ETL tool (if that makes any difference)
So below script is working for sending email to 1 person from file(so file just have 1 email and nothing else),but got stuck on multiple persons and how to loop thru all those values.
echo "Please check the session log in /ciwetl/SessLogs directory.CIW-SUPPORT TEAM" | mailx -s "CIW : Workflow wf_m_LOAD_CIW_LOCATION_RT failed." `cat /filelocation/emailsrc.txt`
EDIT: I have this working with this script :)
cat 'location/emailsrc.txt' | while IFS=, read -r line line2 || [[ -n $line ]]; do echo $line2 | mailx -s "CIW : Workflow wf_m_LOAD_CIW_LOCATION_RT failed." $line; done
But there is another thing i didnt anticipated .... In a body we can have commas so that would probably ruin my file.I was thinking to change delimiter in file to | . I tried to change IFS=| but that didnt work out. Any tips ?
echo. is it the same what you want?