E-mail Notifications and the User Experience

Published on April 20, 2005 at 9:00 PM EST
In the Tutorials category.

I’m a fan of the e-mail notification functionality that’s built into Movable Type. It’s just so easy to click that “Send” button on the Entry screen! (I’m not a fan of MT-Notifier because it sends a notification e-mail for every entry, and I want to send one only occasionally.) For the most part, I add family and friends’ e-mail addresses to the list, but I hope that it’ll get used more by others when a new site design gets implemented in a few weeks. With that in mind, I wanted to change the behavior of the subscription process.

A subscribe/unsubscribe tool is built into MT, and a form for it is available, which is much better than the standard “subscribe” option. The problem is, when subscribing or unsubscribing, the user is taken away from the current page and given a short unformatted message (“The address dan@danandsherree.com has been unsubscribed”) and no obvious way for the user to continue. I set out to remedy that problem.

If I knew more Perl, I could probably hack the MT code to do what I want—but I don’t. Some searching revealed a thread on the MT support forums that helped, though. I was able to hack that code to supply a small JavaScript pop-up that would let the user know of subscribe/unsubscribe success and redirect to another page.

I created a new Index Template to house the notification form. Add the HTML and JavaScript from this post in the MT support forum. Next, edit mt-add-notify.cgi in your MT installation. Replace its contents with the Perl code from this post in the MT support forum. (Does anybody know, could I have legally duplicated all of that Perl code here? Sure would make it easier.)

The last line in that code is “print $q->redirect($q->param('_redirect'));.” Replace that with the following:

print "Content-type: text/html\n\n";
print '<script language="JavaScript" type="text/javascript">alert ("Your e-mail notification list information has been updated."); window.location.href="http://www.yoursite.com/";</script>';

Obviously, make the http://www.yoursite.com bit point to your site. That’s it! It actually takes much longer to explain than actually do. See it in action on the danandsherree.com notification sign-up page—and maybe sign up, too.