Geekuprising.com Logo
Home Youth Debate About Us Clients Services Technologies Code
You are here:: Code > Blosxom > BlosGate- The Email to Blosxom Gateway
spacer
Browse

BlosGate- The Email-to-Blosxom Gateway


NAME

BlosGate- The email-to-Blosxom Gateway


SYNOPSIS

BlosGate is an email-to-blog gateway that allows you to publish to Blosxom via email without procmail rules and/or root access to your server. It should be cross-platform, and of non-core perl modules requires only Mail::POP3Client and Mail::Sendmail to function.

Once you've got the script installed and working, you need but send an email to the ``gateway'' address that the script watches. You'll receive a ``form'' email to fill out, with a random token in the subject line. You reply to this message with your blosxom entry and it will be posted when the scheduled task runs again.

Blosgate runs as a scheduled task via your favorite task scheduler, and allows you to publish to any subdirectory in your blosxom $data_dir where your blog entries are stored.


VERSION

Version 1.1


AUTHOR AND CONTACT INFO

 Daniel Collis Puro, dan at geekuprisingREMOVE_CAPITAL_LETTERS.com
 Geekuprising Internet Consultants
 http://www.geekuprising.com/blosxom


INTERFACE

Application flow:

  1. User sends a ``new entry'' email to the $blog_gateway_address set in the configuration. The script ``watches'' this address (via a task scheduler) looking for new mails to act upon.

  2. When the script sees an email from the $valid_poster_email it generates a token and sends a form email with that token in the subject and a list of subdirectories to publish the entry to.

  3. The user replies to the ``submit entry'' mail, selecting a category and writing the entry in the space provided.

  4. Script picks up this mail on it's next run, verifies the token, and writes it to the filesystem in the directory the user has selected. It then deletes the token.


INSTALLATION

  • Install Mail::POP3Client and Mail::Sendmail, or ask your friendly sysadmin to do it.

  • Create your $blog_gateway_address email address that blosgate will watch and that you'll send new submissions to.

  • Edit the ``blosgate.pl'' file to match your blosxom installation. Make sure to set $plugin_state_dir to a directory that your user account has write access to.

  • Send a message to $blog_gateway_address from the $valid_poster_email account. Upload the script to your server as text, set it to be executable chmod 755 blosgate.pl and try running it from the command line. If you don't get any errors, it should be working.

  • Add it to your task scheduler at whatever interval makes sense to you. Here's a sample crontab entry that will run it every 5 minutes:
      5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script/blosgate.pl


CAVEATS AND NOTES

Blosgate expects email to come from your email client as plain-text. MAKE SURE YOU REPLY TO BLOSGATE WITH A PLAIN-TEXT EMAIL, not an HTML formatted one.

As long as you don't fiddle with the token or the email too much, the script is forgiving of RE's added to subject lines and ``>'' (or other delimiters) used in replies.

If you don't select a category, BlosGate will publish an entry to your root category.

This script is meant to be run as a scheduled task via a task scheduler like the excellent cron daemon.

BlosGate isn't meant to be run as a CGI script.

It will write the files with the same user/group ownership as the user your cronjobs run as- most likely your plain-old user account that you log in with. This means you don't need to make your entries world-writable or change them to be owned by the user your webserver runs as.

BlosGate will use the first line of your post as the filename, with any funny characters stripped out. It will NOT overwrite existing files, it will name files title.txt, title2.txt, title3.txt and so on.

Blog entries should appear between the lines you're told to publish within, and EXACTLY what you type will be written to the category you select.

For example, if you type:

 > Your Blog Entry Follows This Line:*******************************
 Test Blog Entry
 <p>Here's a test blog entry with Blosgate edits. . .</p>
 <p>Man, BlosGate is COOL! I'm gonna name my firstborn after it.</p>
 > Your Blog Entry Ends Above This Line:****************************

Then the blog entry will be a file named ``Test_Blog_Entry.txt'' in the category you selected with:

  Test Blog Entry
 <p>Here's a test blog entry with Blosgate edits. . .</p>
 <p>Man, BlosGate is COOL! I'm gonna name my firstborn after it.</p>

as its file contents.


REQUIREMENTS

Mail::POP3Client and Mail::Sendmail


THE FUTURE

Here's some directions BlosGate could go:

  • Editing blog entries via email,

  • A ``full package'' installer that includes the required modules (possibly via PAR),

  • More abstraction- allow for different modules to serve as mailers and data persistence mechanisms.


LICENSE

Copyright 2003, Daniel Collis Puro

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Use it, abuse it, and let me know what you think. Please tell me about any changes you make, (especially good ones).

Discuss this Article!

Download BlosGate!

Search
File Description Date Uploaded
Blosgate 1.1  ·  txt/15kB 1/12/2004
Copyright 2004 © Geekuprising Internet Consultants