Need to add Birthday images inside shell script

Hi All- I have written a shell script to send birthday wish mail to all my colleagues.

I need help from you all in two things,

  1. I need to add some 17 birthday images as my team size is 17 i want to send different images for everyone. (I dont know how to do it)

  2. I need to send mail to 17 people but i know the command to send only 1 at a time

Could you please alter my script according to my requirement and share me?

Thanks,
Bala

#!/bin/bash
LIMIT=3
IFILE="/apps/fresco/BALACHANDAR/bday.csv"
OFILE="bday_out"$$
MAILID=balachandar.sedouramane@gmail.com
for i in 1 2 $LIMIT
do
arr[$i]=`date '+%d-%b' -d "$i days"`
done
while IFS=",-" read name day month year
do
for DAT in ${arr[@]}
do
DAY=${DAT:0:2}
MON=`echo ${DAT:3:3} | awk '{print toupper($0);}'`
day=`printf "%02d\n" $day`
month=`echo $month | awk '{print toupper($0);}'`
if [ $day -eq $DAY -a $month = $MON ]
then
echo $name : $DAT
break;
fi
done
done < $IFILE > $OFILE
if [ -f $OFILE -a -s $OFILE ]
then
sed -i '1i The users celebrating their birthday are:\n' $OFILE
mailx -s "Birthday List: " $MAILID < $OFILE
\rm $OFILE
echo "Birthday mail sent"
else
echo "No birthdays."
fi

---------- Post updated at 07:22 AM ---------- Previous update was at 07:20 AM ----------

Bday.csv file :

Happy Birthday BALA11-Sep-89User207-Jul-89User315-Jun-95

  1. and 2. are mutually exclusive. You can either send one mail with all the same attachment(s) to n people, or you can send individual mails to n different people with a different attachment in each.
    man mail is your friend.

Okay then send one mail with all the same attachment(s) to n people is fine for me

Can you please revise my code and send with a proper one?

Did you read the mailx man page?

A couple of thoughts...
Add the image file name & path to your bday.csv file, and read it in on that 10th line.
Once you determine (middle of your program) that it is someone's birthday, why not execute the mailx command right there; plus you will know the unique image file to uuencode attach.