Unanswered: change one content in mail body dynamically
l have a unix script to send email. The mail body will be as below. This is a notification email to employees regarding their claim bill submission.
The Claim bills for &CLAIM_NUMBER has not been submitted online and &NO_OF_DAYS have passed since the claim raised. Your claim request will become cancelled 60 days after the claim raised date, at which time payment will be recovered from your salary. Please submit your claim bills online to avoid cancellation and recovery from salary.
The above mail body text I am fetching from a look up table.After fetching, how can I pass the value(Claim Number,No of Days) to the mail body.
ps: I am calling the Unix script from an oracle procedure and sending the Claim Number,No of Days as parameters to script.
I would be more inclined to put the text of the letter in the script.
If you have more than one letter, then have more than one script.
In oracle, call "letter1 ClaimNo Days"
echo "The Claim bills for $CLAIM has not been submitted online and $DAYS have passed since the claim raised. Your claim request will become cancelled 60 days after the claim raised date, at which time payment will be recovered from your salary. Please submit your claim bills online to avoid cancellation and recovery from salary."
I was trying if I can fetch the mail body from a look up table so that it would be easy for future modification.
In Script,I am fetching the text from table to a variable and making it as a .txt file and keeping in a folder. At last, using mutt command and sending the .txt file as mail body to the recipients.
As I am taking the mail body text from database table, I don't know how to change 1 or 2 contents in mail body text dynamically per the parameter value passed. ie; If the days parameter is 25, it should come 25 in mail body.. if it is 50, the value should be same in mail body text.
Did you delete your last post? I received an email notification, but I don't see the post.
You have to have a process that reads and writes the body of the email in order to merge the substitutions.
You can do this in the oracle portion, and then pipe the output into a ksh script that emails it using mutt. If you do this you maintain the letter within the oracle database.
sqlplus letter |mutt -s "notice" email@address
You can maintain the letter in a ksh script, and use echo to process the substitutions.
echo "Submit the backup for your expenses $CLAIM that is $DAYS old\n Or we will take it out of your pay." |mutt -s "notice" $EMAIL