Today while I had to send out emails to attendees of Linuxfest 2013, I sat down thinking of a way to mass-mail. The emails should display the name of attendees so that they may notify me if it’s mistyped. Sendmail and a bunch of command line utils could do the trick.

###What do I need in my arsenal?

mailx, a Linux command line utility for sending and receiving mail.

paste which is among the lesser-known Linux command line utilities. It joins files horizontally by outputting lines sequentially next to each other.

I earlier kept the names and email addresses in a CSV file, which makes it easier to be read by utilities. I was wondering if I could use awk to get the job done without using paste, but my creativity was at low (possibly due to lack of caffeine). So, I only used awk to send names & email addresses in two separate files. ``` awk -F”,” ‘{print $1}’ linuxfest2013.csv > names.list

awk -F”,” ‘{print $2}’ linuxfest2013.csv > emails.list Now, I had my two files containing names & emails, which could be vertically aligned next to each other. I put the message to be sent in a file named message.txt. Finally, I trigger the mass mail as follows: paste emails.list names.list | while read email name; do echo cat message.txt | mail -s “Linuxfest 2013 | echo $name” -r my_email echo $email; done ```