Hi!! I am trying to write a script that will send mail with a fixed content to email addresses fetched from a db2 table. I want the mail to appear with To, From, Cc and Subject Headers. Any idea how to do it.
This is what I have been trying:
db2 -x "SELECT USER_EMAIL_ID FROM <table_name> WHERE (LST_LOGIN_TS + 30 DAYS) >= TimeStamp (Current TimeStamp)" >mailing_list
mailing_list1=$(cat mailing_list | tr -s ' ' | tr '\n' ',' | sed 's/,$//')
cat body | mail -r "xyz@yahoo.com" -c
abc@yahoo.com -s "Account Deactivation." $mailing_list1
#body is the name of the file that contains tha actual body of the mail to be sent.
But I am not sure of I can hardcode tha name of the sender using the -r option as I have done above. Also I am not sure if the names of sender, receipients, subject will appear as To:, From: and Subject: Headers in the mail. Any help will be appreciated.