Thursday, January 28, 2010

Posting to Blogger from Perl

Here is a little snippet that allows you to post to your Blogger blog from Perl:

use Net::SMTP::TLS;
my $mailer = new Net::SMTP::TLS(
    '',    # dont change
    Hello    => '',         # dont change
    Port     => 587,                      # dont change
    User     => '', # change to your username
    Password => 'password'                # change to your password

# you email address associated with the blog

# the address to send the post to

# blog post body
$mailer->datasend("Subject: Title of my blog post\n\n")
  ;                                       # keep the trailing \n\n!
$mailer->datasend("The text of my post here\n");

# end blog post

Let me know how this works for you!