O'Reilly logo

BlackBerry Hacks by Dave Mabe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #38. Blog from Your BlackBerry

Why should you blog only from your desktop computer?

You have just thought of a brilliant idea that you have to blog about right away, so like a caveman, you scribble it down on a piece of paper and hope you don't lose it before you return to your computer. You might not even remember to blog when you return to your computer, and your precious idea is already turning stale anyway.

It doesn't have to be this way. With most blogging software, you can turn on email-to-blog functionality so you can blog from any email-enabled device—a domain that is ruled [Hack #31] by your BlackBerry.

Turn On Email-to-Blog Functionality in Blogger

From within Blogger, Google's popular blogging service, log in and go to your blog administration page. Click on the Settings tab, and then click on the Email heading and go to the Email-to-Blogger section.

Blogger has you create a "secret" email address that allows any messages that get sent to it to be automatically blogged. As shown in Figure 4-3, the email address is constructed with your Blogger name, followed by a string of your choosing. The Publish checkbox tells Blogger whether to go ahead and publish the content of messages as they are sent or to add it to your Blogger admin page without publishing, giving you the opportunity for review before your blog visitors see it.

Blogger's email-to-blog settings

Figure 4-3. Blogger's email-to-blog settings

Write by Email in Wordpress

Wordpress is another popular blogging software package that is written in PHP and runs on Apache and has a MySQL database backend. Along with a mountain of excellent plug-ins, it has a built-in feature that allows you to publish to your blog by email.

Log into your Wordpress administration page and click on Options Writing. This brings you to the Writing Options page as shown in Figure 4-4.

This Wordpress functionality requires a little more work than Blogger's does. You have to have already created an email account that is accessible via POP3 (a free, ad-hoc Gmail account is a good choice because of its built-in spam protection). You configure the POP3 settings to tell Wordpress where to retrieve messages from. Use the "Default post by mail category" option to choose one of your categories that all posts by email will go into. Of course, you can always go back and change the category and even add additional categories after a post has been published.

Wordpress writing-by-email option

Figure 4-4. Wordpress writing-by-email option

Once you've sent a message to the blog-by-email account you've set up, you'll need to visit this page: http://your.blog.url/wp-mail.php (wp-mail.php is in the same directory as your main index.php, so the URL could vary depending on your setup). This scans your mail and posts any messages in your inbox to your blog.

Tip

Many Wordpress users choose to automate this step by using a scheduled job to make the request to http://your.blog.url/wp-mail.php on a regular basis. There are a variety of tools you can use to make HTTP requests. One tool is lwp-request, and it comes with ActiveState Perl, a tool that is used in several of the hacks in this book. (If it didn't come with your Perl intallation, you can obtain lwp-request as part of the libwww-perl collection at http://lwp.linpro.no/lwp).

Blog Away

Once you've configured your blogging software to accept email, go ahead and compose a message from your BlackBerry. The subject line will become the title of your post, and the body of the message will become the post content. Figure 4-5 shows a composed email message I've sent to my Blogger blog.

Blogging from a BlackBerry

Figure 4-5. Blogging from a BlackBerry

Almost instantaneously, the blog appears on my blog, as if I posted it from my desktop browser (see Figure 4-6).

My email-to-blog entry

Figure 4-6. My email-to-blog entry

Warning

You don't want spam finding its way onto your blog (what a nightmare that would be!), so you need to choose an email address that it not easily guessed and is longer than a few characters. Blogger enforces a length of at least four characters, but I would highly recommend one that is much longer. You'll only have to type it once into your address book, and then you'll just pick it from your list when you compose a message, so make it complex and lengthy, just as you should for an important password.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required