Saturday, September 4, 2010

How do we send peewee emails

Being a software developer (computer weenie), I thought I would let everyone know how I send my emails. If you are big on computers and software, read further....

During the summer, I decided that manually sending emails to over 200 players times N emails was not going to work for me. Experience has shown that managing group emails from Mozilla Thunderbird is a big pain. And the one standard email to everyone was not going to work either.

My day job at the IBM Ottawa Software Lab is a software development manager developing model-driven development products at IBM Rational Software. Applying some modeling techniques is the way to go.

KMHA provides a big spreadsheet with the registration data. From Open Office, I can export the spreadsheet as a CSV file. (I do not use Excel, I am a Ubuntu user). I wrote an Eclipse plug-in to load the CSV file into a model, more specifically an EMF Model.

The model is effectively a database with a record for each player and fields for all the player data (names, emails, positions, addresses, previous year history, etc). Once I have the model, I wrote another plug-in to generate email messages.

An email message is simply an HTML file. I wrote a plug-in several years ago to generate web pages from an EMF model. It was a simple exercise to change this to generate KMHA email messages. Plug-ins are all written in Java.

There are two parts to the message, the HTML content of the email and the To:, Subject: and the commands to send the email. I use sendEmail to send the emails through my Rogers SMTP gateway. I use a shell script to send each email.

So the process to send an email is to:
  1. Create the Java class that generates the email.
  2. Run the generator that creates the shell scripts containing the sendemail command and HTML content.
  3. Run the scripts from the command line.
I am already finding big benefits from the email generator:

First off there is huge flexibility in my email messages. In my first email, I was able to add some logic that if the player was no longer registered as a goalie, I could add the line:
  • Since your son has changed his GOALTENDER registration since last year, I need you to confirm this change is correct.
I caught two goalies incorrectly registered as players and caught this up front and not at the start of sort-outs.

By adding some logic for new players, I was able to add the line:
  • My information does not indicate a team or position for last year. Without a team from last year, I will assume your son is new to minor hockey in Kanata. In this case I would request a brief reply with his previous ice hockey experience, years played, and anything else that would be useful for initial sort-outs.
I now have some great feedback from parents of new players.

I also was able to skip creating competitive players emails using logic as best I can in the generator.

Second off, I could personalize the emails and send one email to each player:
  • Welcome ANDREW HUNTER to KMHA Peewee 2010-2011
I have received many comments how organized the emails appeared. All of these personal frills were generated.

Third, complete logs of every email. As you can imagine, I received lots of "you did not send me" and "I did not get". I have logs of the emails sent, and the line in the log:
  • Aug 17 19:16:18 ltahunter sendemail[795]: Email was sent successfully! From: To: Subject: [Welcome ANDREW HUNTER to KMHA Peewee 2010-2011] Server: [smtp.broadband.rogers.com:25]
I can confirm the email went to Rogers, where it goes I do not have much control, but I know when the email was send successfully from my rogers account.

I have tested with as many email readers as I can to confirm the email content is clear and readable: gmail, yahoo, hotmail, microsoft outlook, lotus notes, thunderbird, godaddy's online reader, etc.

If anyone observes something "odd" with the emails, let me know.

No comments:

Post a Comment