Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2014
    Posts
    2

    Unanswered: change one content in mail body dynamically

    Hello Experts,

    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.

    "Note:

    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.

    Thanks,
    Finance Team."

    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.

    Any help would be much thankful.

    Regards,
    Prajeesh

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    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"

    In ksh/bash
    Code:
    #letter1
    CLAIM=$1
    DAYS=$2
    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."

  3. #3
    Join Date
    Apr 2014
    Posts
    2

    Smile

    Hello Kitaman, Thanks for your help.

    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.

    Thanks again.

  4. #4
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Did you delete your last post? I received an email notification, but I don't see the post.
    Anyway.
    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.
    Code:
    sqlplus letter |mutt -s "notice" email@address
    You can maintain the letter in a ksh script, and use echo to process the substitutions.
    Code:
    CLAIM=$1
    DAYS=$2
    EMAIL=$3
    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
    and call from oracle as
    Code:
    letter1 clm123 25 john@office.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •