Beatitude - A Scheduled Mailer for Dada Mail
Beatitude is a plugin for Dada Mail that allows you to compose email messages to be scheduled for sending in the future.
Highly configurable, messages themselves can be in PlainText, HTML or multipart/alternative and have an unlimited number of attachments. The message itself can be composed in the plugin itself, fetched from a file or from a webpage.
The schedules themselves can be anywhere from one minute to years into the future and can be repeated infinitely. Schedules also have many safegaurds to help send only new content; for example: if a scheduled mailing is created to send the contents of a URL once a day, it will only send that URL if the contents are different from the previous day.
It's best to get all these requirements in order before you begin.
http://search.cpan.org/~ams/Storable-2.08/
and install it.
There's a few things you need to configure in this script, they're all at the top.
use lib qw( /home/myaccount/www/cgi-bin/dada /home/myaccount/www/cgi-bin/dada/DADA /home/myaccount/www/cgi-bin/dada/DADA/perllib /usr/local/lib/perl5/site_perl/5.8.0/mach /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.0/BSDPAN /usr/local/lib/perl5/5.8.0/mach /usr/local/lib/perl5/5.8.0 );
If you don't know where your Perl library is, trying running this via the command line:
perl -e 'print $_ ."\n" foreach @INC';
As far as required changes, that's it. We'll get to interesting optional things further down the line.
Beatitude is both a command line script and a CGI script.
More specifically, as a CGI script, it's a Dada Mail plugin. To install the script, it's best to put the scheduled_mailings.pl file into the plugins directory inside the dada directory, which is itself in your cgi-bin. If that directory doesn't exist, it's safe to make it.
Once the scheduled_mailings.pl script is inside that directory, change it's permissions to, 755 and view it in your web browser.
If the installation was done correctly, You'll most likely see a screen that asks you to log into your list.
Add this entry to the $ADMIN_MENU Config.pm array ref:
{ -Title => 'Scheduled Mailings', -Title_URL => $PLUGIN_URL."/scheduled_mailings.pl", -Function => 'scheduled_mailings', -Activated => 1, },
It's possible that this has already been added to $ADMIN_MENU and all you would need to do is uncomment this entry. This adds a menu item for Beatitude in Dada Mail's List Control Panel.
Since this program is also command line tool, you can execute it via a command line. Running Beatitude with the --run argument will have it check if any schedules should be run, and mail messages that need to be mailed.
prompt>./scheduled_mailings.pl --run
I suggest before you do that, you test the scheduled_mailings.pl script.
You can pass the --test argument to scheduled_mailings.pl to make sure everything is workings as it should. The --test argument does not take any arguments. If everything is set up correctly, you'll get back a verbose message of the going's on of the script:
prompt>./scheduled_mailings.pl --run --test
------------------------------------------------------------------------ Running Schedule For: mytestlist Current time is: June 26th 2003 - 5:25 pm No schedules to run. ------------------------------------------------------------------------
In this example, Beatitude checked schedules to be run for the 'mytestlist' list, found none, and exited. If there is a schedule to run, the output my look like this:
------------------------------------------------------------------------ Running Schedule For: mytestlist Current time is: June 26th 2003 - 5:33 pm Examining Schedule: 'Justin's Test Schedule' 'Justin's Test Schedule' is active - Schedule last checked: June 26th 2003 - 5:31 pm Next mailing should be on: June 26th 2003 - 5:33 pm 'Justin's Test Schedule' scheduled to run now! ------------------------------------------------------------------------
You want to set this script to execute via a con or scheduled, job. Here's what a theoretical cron tab for this script may look like:
0,30 * * * * /usr/bin/perl /home/myaccount/www/cgi-bin/plugins/scheduled_mailings.pl --run >/dev/null 2>&1
This will run the script every half hour. You can run this script as often as you want, just be logical. I wouldn't run this script every five minutes, that's a bit overkill.
Different hosts may have a control panel to set up crontabs, my host gives me the pleasure of the contrab command. I type in:
prompt> crontab -e
and am launched into my favorite text editor to type in the crontab.
There's a slew of optional arguments you can give to this script:
prompt>./scheduled_mailings.pl --run --verbose
passing the --verbose parameter is like giving this script some coffee. Similar to what you'd see if you ran the script using:
prompt>./scheduled_mailings.pl --run --test But the scheduled mailings will actually get sent.
If you don't want to pass the log each time, you can set a log in the $Log variable.
prompt>./scheduled_mailings.pl --run --version
WIll print out both the version of Beatitude and also of Dada Mail. Good for debugging. Looks like this:
Beatitude version: .1 Dada Mail version: 2.8.8
./scheduled_mailings.pl --run --list myslistshortname
If you want to run schedules for only one list, you can pass the --list argument to scheduled_mailings.pl with a listshortname as its value.
You'll need to do a few things:
http://sourceforge.net/tracker/?group_id=13002&atid=113002
It also means, ``a state of supreme happiness''.
But to me, I think of Beatitude as almost a shorthand for, Beat Attitude; the Beat Generation being a group of writers whose inner circle included Jack Kerouac, Allen Ginsberg, William Bourroughs, Gregory Corso and many more.
To Kerouac, ``Beat'' -- a shorthand term for ``beatitude'' and the idea that the downtrodden are saintly -- was not about politics but about spirituality and art. -Douglas Brinkley
A modern Beatitude would be Ginsberg's Please Master, found in the book, Fall of America.
The Beat Generation attempted to communicate the thoughts, ideas and adventures of their normal lives. I can only hope that communication with my Beatitude will be a tenth that incredible.
My personal bookshelf is overflowing with books from the Beat Generation authors and one reason I moved to Boulder, CO, and then Denver, CO was because of the Denver adventures of Sal Paradise and Dean Moriarty in On The Road and to be close to the Jack Kerouac School of Disembodied Poets in Boulder, CO.
Now that archiving works, Beatitude should play well with the Clickthru tracker. Grr!
minor bugs fixed in regards of erroneous messages saying that the schedule was ended if the mailing schedule was indefinite.
Repeated schedules would not get sent if the schedule had never been checked before. Although a minor bug, it is rather annoying.
This issue should be fixed.
There was a bug in the supporting libraries that affects repeating schedules. It's advised that if you run repeating schedules, that you upgrade to vesion 2.8.9 of Dada Mail.
Look into ways to couple Beatitude with such apps as Blogger and Movable Type. (and if anyone who uses that sounds interested, let me know...)
Copyright (c) 1999 - 2003 Justin Simoni me@justinsimoni.com http://justinsimoni.com All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.