To go green, this time, we decided to avoid printed certificates for department conference. And from there, came this concept.
Input: Certificate template, NAME, COLLEGE and EMAIL IDs of participants
Output: Generates certificates for each participant, and mails it to them.
- Generate NAME, COLLEGE and EMAIL list of participants.
- Place NAME, COLLEGE (text) on the certificate template (image) starting at given pixel coordinates.
- Fire an email client with EMAIL in to: and addressing NAME in body. I would recommend setting it to manually click send instead of automating it – little time consuming, but I suspect quick, automatic mailing to multiple email IDs may cause provider to blacklist you as a spammer.
Here is how I implemented it – our conference had 85 participants. I used BASH, imagemagick and Thunderbird to achieve the target.
Reason I Chose:
- BASH – cut the codes short to less than 10 lines compared to Java/MATLAB which has its own advantages, but not worth the time.
- Thunderbird – Was already installed and configured to my taste and had
- convert – I’m on Linux Mint and it’s preinstalled.
- Any flavour of Linux
- “convert” from package imagemagick.
- Thunderbird configured with the right email ID.
- Certificate template in any common image format.
- A file named NameList.txt with NAME, COLLEGE, EMAIL in one line each. File would look like:
NAME1 COLLEGE1 EMAIL1 NAME2 COLLEGE2 EMAIL2 ...
FILE=../NameList.txt cd Certificates while read NAME; do read COLLEGE read MAIL convert ../Certificate.png -gravity North -pointsize 20 -annotate +100+318 "$NAME" Certificate.png convert Certificate.png -gravity North -pointsize 20 -annotate -200+345 "$COLLEGE" Certificate.png thunderbird -compose "firstname.lastname@example.org',subject='Conference Certificate',to='$MAIL',attachment='~/CGAM/Certificates/Certificate.png',format='html',body='Dear $NAME,<br/><br/> Please find the certificate attached.<br/><br/>Regards<br/>Organising Secretary'" done < "$FILE"
This code generates a temporary certificate in the folder Certificates notice that parameter “-annotate +100+318” in line 6 give s x and y coordinates of beginning of NAME text, and similarly in line 7 for COLLEGE text.
Certificate template is placed in the same folder as the script, called Certificate.png. Generated certificates will be placed in subfolder Certificates in a temporary file “Certificate.png”.
- Leave thunderbird closed while running the script else the script fails. (Script will not wait for mail to be send before generating next mail).
- It’s imperfect enough, if interested, please make a better, neater, simpler app (I am lazy to! :D) so that the world can run it in few clicks.
- Instead of thuderbird, you can automate mailing using command line utilities like “mail” or “msmtp” etc. Read more here.
Why did I post this stupid code/idea here? I don’t know – what if it helps someone, somewhere in future? I couldn’t find a neat app which does the same online, either! I will try inspire my students to take it up as a personal project and come up with some neat click-to-do codes as well.