PET-Gateway is a clunky interface to translate between a pair of email addresses and twitter (written in Perl, wouldn’t you guess). At the moment it has far too little documentation, but this will be corrected after I get back from the slopes.

However, the short version is:

Firstly, download the script from Google Code, and its numerous dependencies from CPAN.

Then, setup two emails, one as the twitter-server proxy and a second as the twitter-client proxy (you may already have this, like your work email thats hidden behind an oppressive  or an email you can access in an even more oppressive dictator regime).

In the poorly documented config file you at the smtp and pop3 details (IMAP coming later), and the client proxy as the “to email” and the add the server proxy username and password under email.

At this stage the pop3 and smtp servers both need to support ssl and use the same details, again this will be updated at a later stage.

Now, copy the .rc file with the same name to your home directory and run the script. It will ask to be oAuthed against Twitter using a URL and the returned PIN code. Make sure you are logged into to Twitter when you browse to the given URL.

After that you are all setup, just add a cron job with a command like:

*/2 * * * * ~/path_to_pet-gateway/pet-gateway.pl >> ~/.pet-gateway.log

to make the process run as often as you need and you are all set to tweet to your hearts content, even when you can’t access Twitter!

When you send to the server email address, it only posts the message body upto the first line break, splitting it across tweets if it has too, and also looks for attached images to upload to imgur.com. Also, if you want to reply to another tweet, reply to the email the server-proxy sends you, and the it prepends the sending users username automatically, and sends the update properly including the originating tweets ID so the tweets thread correctly.

If you find this useful, add a comment here and let me know, and if you find issues with my code feel free to submit a bug, path, diff or complain on the google code page.