Mail Merge 

I remember long back, during school, we had to learn this thing called ‘Mail merge’ in Wordstar or something like that. (I remember mugging those wordstar shortcut keys like C-k b, C-k k to mark blocks and crazy stuff like that) I felt it was a great thing to be able to mass mail people and still make it sound very friendly:

Dear Mr. <n00b-who-got-fooled-by-mailmerge>

I was in a similar situation when I needed to send out BAS Web-Privy Members’ accounts (like for instance). So this is what I did – I had the members’ names, ftp logins, passwords blah blah blah and their email address in a ‘:’ separated list in a file, where I saved the details as and when I created the accounts. Then, I typed some e-mail format that went like

Dear NAME,

Your account has been created, your login name is FTPAC and password is FTPPASS

b lah blah blah

Then, I wrote this tiny, ugly bash script that did it. It’s highly inefficient and I’d love to hear ways to do this more efficiently. Here it is. Basically uses awk on each line of the file listing the account details (‘webmem’ as I’ve called it) to retrieve the info into variables and then uses sed on the email format to replace all those “NAME” and “FTPAC” stuff by their corresponding values. Finally, pipes it into mail to send it to the account holder.