Using Dada/Mojo Mail to send MovableType Entries Nightly (or how to ditch Bloglet)
Update: I'm bumping this back up to the top as I've updated my templates and this article in general pretty heavily. Be sure to check it out.
Note: To pull this off, you'll have to invest $25. It's worth it for great mailing list software, but if you're a cheapskate, do not read past this point. Also note that I didn't just conjure all this up after my surgery, it's been done and ready to go for a while, I just got motivated to finish it up.
I've been a big fan of Mojo Mail (now called Dada Mail because somebody has too many lawyers and too much free time) for a long time. I originally set it up for my work site, and have always loved it.
I recently purchased (before I knew I needed surgery) the Pro version of the software which came with the Magic Book. The $25 Magic Book is the key to this -- it's loaded with tons of extra documentation, and it comes with a bunch of cool plugins. The one I like the most is an automated mailer that will send mailings at predefined intervals, pulling from Web pages, if need be. It's called Beatitude.
I've been using Bloglet to send nightly mailings of the headlines on the site. Bloglet, while, simple, isn't very flexible or powerful. So I thought, why couldn't Beatitude be used to send off MovableType nightly entries?
As of three days ago, it is, in both a text and HTML formatted version. Sign up using the sign up form on the top right of this page, and read on below to see how I did this.
First, you need the Dada Magic Book. That's the only way you're getting Beatitude (and the clickthrough tracking plugin, mentioned below as well). It's $25, which is wonderful for how powerful the thing is.
Second, here's the tricky part. MovableType and Dada are both hearty Perl scripts that rely on Perl library files installed in their directories, and they also have a couple of identical folder names. When I tried to install it in a "dada" foler in my "cgi-bin" where MovableType was installed, things didn't seem to work. There were too many libraries that didn't want to play nice with each other. So I created a sub-domain (dada.utterlyboring.com) and installed it there. You may have better luck than I, but I know that's the only way I could get it to work.
Third, follow the install directions to install Dada and Beatitude properly. I'm not here to walk you through that, as there are great forums and documentation for that sort of thing (and the Magic Book purchase that's required to pull this off includes awesome documentation for both). If you have the money, the author of the software will install it all for you. But follow it all step-by-step and you should be fine.
Once it's installed and your CRON job is setup properly (if you don't know how or can't setup a CRON job, you can't do this), you need to create two new MovableType Index templates: One for the HTML version of the list, and another for the text-version of the list. You can set them up however you like. I set mine up so it takes the last day's entries, and then marked off the settings in Beatitude to only send if the mailing is different than the previous mailing (so if I go a day without publishing, it hopefully won't send) and/or if there's no data. I also wanted to make sure that, in my case, if I post something after midnight but before my mailing list job gets sent, that those entries get included, too (basically, spanning two days instead of one), so I had to do some creative coding/tweaking with the templates (with a little PHP help).
Here are the templates I use for my site, and they will be updated if I figure out a better way to do any of this:
Once you've created those index templates, set them up so they rebuild automatically. Then, in Beatitude, set your mailing to run once a day (if you're using my templates as a guide and want to have the after midnight check, set it to run at about 2 AM the morning after your entries are posted), pulling those compiled index templates, set your schedule, and go.
You'll notice on those templates that, other than the entries themselves, there's very little dynamic content (no comment/trackback count, etc...). That way the data won't change, so that trigger won't be a problem.
I've also made it PHP-based so that if there are no entries in the last 24 hours, it should be entirely blank, meaning Dada won't send it. Granted, it may be a while before I have a blank day to test this, but it could happen.
If you'll look at my templates, there's also a couple things you'll see in there. One, to create a dynamic subject line for the e-mails, I've added a bit of text to the template before the template itself renders.
Subject: UtterlyBoring.com Headlines from 11/20/08
What that does is takes the current date, substracts a day (since that's when my entries were written), and prints it up as part of the subject. You need to make sure the "Grab Headers..." boxes are checked, and that you follow the Magic Book documentation.
My HTML template also includes ClickThrough tracking (it makes the URLs too long to include it on the text-version). That's another Dada Magic Book plugin that you will need to setup. It's entirely optional, and is in Beta, so it doesn't work super great, but it works. You'll see in some of the HREFs of that template have "[redirect=" before the URL. That prepends the URL with a tracking URL (going through Dada) so that I can see how many people clicked on certain links in my outgoing e-mails.
I'm always looking for input to make this better, so please feel free to comment here, or e-mail me directly. I have the developer's support on this, so anything that we find that's needed, he's listening.
11 Comments
Justin Simoni said on 12/21/03 @ 03:03 PM: VERY cool Jake; let me know how this all works out with you. Maybe I'll put this on the "to-do": install Moveable type myself and see what the flutter may be. I'd LOVE to get the support of the Moveable Type crowd in using Dada Mail.
Jake Ortman said on 12/21/03 @ 03:06 PM: Well, I'm doing my best to get you the support (and some extra beer money). MovableType is a fun script, and it's Perl, so you'll probably even understand it (I don't for the life of me, but ah well).
Jennifer said on 12/23/03 @ 04:53 AM: VERY cool!! :D I've been kinda frustrated with bloglet just because it's been a bit unreliable.
Would you be interested in cross-posting this as a guest author on scriptygoddess?
Jennifer said on 12/23/03 @ 05:01 AM: Oh- one more thing... re: "Anybody have a plugin that will make a document/template completely blank (no tags or nothing) if there wasn't a post in the last 24 hours? That way Dada won't touch it." - Couldn't you do that with PHP? Put an "if" statement around the entire page - that checks the date of the last MT entry and if it's older than 24 hours - do nothing...?
Jake Ortman said on 12/23/03 @ 08:46 AM: OK, but how do I find out the date of the last MT Entry? I was actually trying to use that, but I couldn't find a tag that would work outside of the MTEntry context.
As for the guest column, let me get a few things on this hashed out, then if I can't write one up, you're welcome to link to it :-)
Justin Simoni said on 12/27/03 @ 07:36 PM: Jake,
Just to let you know, I got archiving working for Beatitude, and Clickthrough tracking works like a dream with it now as well! I'll let you at the beta once I work on it a little more.
Jake Ortman said on 12/27/03 @ 07:43 PM: Sweeeeeeeeeeeeeet....that's awesome! Keep me posted, Justin!
I'm still working out some bugs in the templates I'm using. Right now, if you post an entry every day, it works fine, but, if I skip a day, it still sends, as my document isn't going blank and I have no idea why.
I need to get a better PHP/MT guy to look at 'er. But it's still sending fine, it's something I need to figure out.
Bob Jordan said on 12/28/03 @ 12:26 AM: This is close to what I need. I maintain a high school soccer website using Blogger and Dada Mail. I want a posting on the site to be sent immediately to my mailing list. Right now I post to the site with Blogger and then open Dada mail to send the same posting to the list.
Blogger can send a posting to a single email address upon publication. I used Bloglet prior to Dada Mail because of this. Unfortunately, Bloglet only sent out once per day AND it was terribly unreliable. It sounds like I could use Beatitude to get the same functionality I used to have with Bloglet with greater reliability.
I want to enter the data once and have it posted on the web and distributed by email. Any ideas?
Jake Ortman said on 12/28/03 @ 08:55 AM: Unfortunately, I have no idea, as I don't know how blogger works well enough to recommend a "best path".
kunal said on 04/18/06 @ 01:10 AM: Is there any other way to send mail without using mail() function in php?
maximus said on 10/19/07 @ 02:31 PM: maximus best
Post a comment
|