SecondBlogger is a free site I created that allows anyone with a Second Life avatar to register and blog to a common location. It runs on the Wordpress back end, but also includes an option for people to blog from in-world, by sending an email post-card. This script will allow you to do this from most systems running *nix flavors. This script included here assumes you are running Wordpress on the ISP Dreamhost, however, it should be fairly easily modifiable for any major Linux-based hosting solution using PHP and MySQL; I’ve used it under two, one running sendmail, and one running qmail. It can be easily modified to use a single file in /var/spool/mail – but is currently configured to use a /Maildir configuration. It isn’t pretty – it is brute force – for it works.
Here’s a link to download the PHP script source:
http://www.peregrinesalon.com/process_sl_snap.phps
General instructions:
(1) The script uses ImageMagick, which comes included with most Linux distributions, and is pre-installed on most shared ISPs (like Dreamhost). To find out where it is installed, simply type “which mogrify”, and that will tell you what path to use for the variable $imagemagick_path. ImageMagick is free, so you can also download and install it, if it isn’t installed.
(2) If you’re using Dreamhost, you’ll have to set up an email account to receive posts. Go to Mail –> Manage Mail, and create an account (something like blog@yourblog.com).
(3) Still on Dreamhost, you’ll now have to set up an Email Filter, in the left hand navigation. Since all SL snap shots contain the word “Visit”, I set mine to forward all messages that arrive to blog@secondblogger.com to forward to my user account on my machine, and then stop. This will take any email that arrives, and write is as a flat file into “Maildir/new” under your shell account. The script will then pick up any email from that directory and parse it.
(4) Be sure to set all the variables at the top of the script correctly. Try running it with the command “php process_sl_snap.php” from the command line, and see what happens!
(5) Next, set up a cron job to run the script on the regular basis. On Dreamhost, click Goodies, Cron Jobs, and add one. Rename the script from source to a .php extension, and set the cron job up to run every six minutes (the maximum for most shared ISPs). I run it at 0, 6, 12, 18, 24, 30, 36, 42, 48, and 54 minutes after the house, every hour, with the command “php /home/user_name/process_sl_snap.php”.
(6) That’s it! This is clearly done for Dreamhost, but most ISPs support similar functionality. You’ll have to find out how to route email to your shell account, and run the script.
(7) I’m very busy, so I’m afraid I can’t offer support for this; the product is provided as-is, with no guarantees of any kind. If you have luck getting it to work on a different configuration, please post to comments what changes (if any) you had to make, and a link to any new source code modifications you have made. There’s tons of room for improvement to this script, as I hacked it together pretty quickly one Saturday morning when I couldn’t sleep in!
