Send Birthday Email Alerts

#!/bin/ksh
data_file=”/u2/scripts/data”
email_file=”/u2/scripts/birthday.email”
today_month=`date +%m`
today_day=`date +%d`
today_date=”$today_month,$today_day”
before_15_days=”$today_day-15″
all_friends=”$(grep -v ‘^#’ $data_file | grep $today_date)”
for friend in $all_friends
do
email_addr=$(echo $friend | cut -d , -f 5)
if [ -z $email_addr ]; then
continue
fi
first_name=$(echo $friend | cut -d , -f 1)
last_name=$(echo $friend | cut -d , -f 2)
full_name=”$first_name $last_name”

echo “$full_name” “$email_addr”

sed “s/_:/$full_name/g” $email_file | mailx -s “Happy birthday to you Mr. $full_name.” -c “it.department@company.com” $email_addr

done
exit 0

Create a file called data with the data entry for birth date, name and email address

John,Doe,01,05,john.doe@company.com
Mary,Bright,09,28,mary.bright@company.com
William,Smith,05,14,william.smith@company.com

Create a file birthday.email with template for ascii text to be send.

Dear Mr. _:

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
~*~*
~*~*  ISD DEPT WISHES YOU MANY HAPPY RETURNS FOR THE DAY
~*~*
~*~*  HOPE YOU HAVE A JOYOUS, SUCCESSFUL & HEALTHY YEAR AHEAD OF YOU !!
~*~*
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

,-.
| |
| “–.  ,–.-.,-.–. ,-.–. ,-. ,-.
| ,-. \/ ,-. || ,-. \| ,-. \| | | |
| | | |\ `-‘ || `-‘ /| `-‘ /| `-‘ |
`-‘ `-‘ `–‘-‘| .–‘ | .–‘  `–. |
| |    | |        | |
`-‘    `-‘        `-‘
,-.     _       ,-.  ,-.        ,-.
| |    (_)      | |_ | |        | |
| “–. ,-.,-.–.|  _)| “–.  ,–” | ,–.-.,-. ,-.
| ,-. \| || ,-./| |  | ,-. \/ ,-. |/ ,-. || | | |
| `-‘ /| || |   | |  | | | |\ `-‘ |\ `-‘ || `-‘ |
“-‘–‘ `-‘`-‘   `-‘  `-‘ `-‘ `–‘-‘ `–‘-‘ `–. |
| |

iiiiiiiiiiiiiiiiiii
|||||||H|A|P|P|Y|||||||
__|_____________________|__
|\/\/\/\/\/\/\/\/\/\/\/\/\/|
|||||||B|I|R|T|H|D|A|Y|||||||
|,,,,,,,,,,,,,,,,,,,,,,,,,,,|

Best Regards,

_______ _______ _______     _______ _______ _______ _______
|\     /|\     /|\     /|   |\     /|\     /|\     /|\     /|
| +—+ | +—+ | +—+ |   | +—+ | +—+ | +—+ | +—+ |
| |   | | |   | | |   | |   | |   | | |   | | |   | | |   | |
| |I  | | |S  | | |D  | |   | |D  | | |E  | | |P  | | |T  | |
| +—+ | +—+ | +—+ |   | +—+ | +—+ | +—+ | +—+ |
|/_____\|/_____\|/_____\|   |/_____\|/_____\|/_____\|/_____\|

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s