How To Blog By Email Without Problems In WordPress!
It sounds like a dream: write a post from anywhere in the world in your email program or on your Blackberry, press Send, and have your blog instantly publish the post for all the world to see.
Unfortunately, WordPress makes it difficult to effortlessly publish by email. Until now, that is. Using a trio of plugins, and some simple writing tips, you now have a variety of ways to use your email to create posts, every bit as good as the ones you can enter directly into WordPress via the Admin Post panel.
The Key To Posting
From the outside, posting by email is rather simple. To break it down, it requires:
- An email account to send your emails to that only you and WordPress know about.
- WordPress being set up to properly handle and post the resulting email to your blog.
- A way of regularly having WordPress check that mailbox.
When set up right, sent emails are quickly converted to posts: the body of the email becomes the body of the post, and the subject line of the email becomes the blog post’s title. Simple and easy.
Step 1: Secret Emails
The first step: set up a secret email account. Generally, I recommend coming up with a random string and getting a gmail account – for example, mirdbasdkilajeq@gmail.com Additionally, you want to create a random password to go with it, and store both somewhere for safekeeping. Then set up the account.
Stuck? Use this to generate a random email name and password to set up a Gmail account – just keep pressing until you’re happy with the results:
Step 2: Checking The Account
Once you have the email account, you’re ready to set up WordPress to read it. For this, the Admin panel at Settings; Writing; Post via e-mail is where you enter the information to access the account.
While each account has a slightly different way of accessing, in general, you can use port 110 (the default), and a prefix, including the domain name, for the server: smtp.egwebsite.com, pop.egwebsite.com, mail.egwebsite.com, etc. Your account FAQ should give you the settings. As well, the login should be your email user login, sometimes with the domain. Once entered, save these settings.
With WordPress set up to read your secret email account, you can begin testing. Open up your email program and send a test TEXT (not HTML) message to begin.
A brief interjection about email programs – in my testing, I had no problem sending posts via Eudora and Thunderbird, but Outlook Express interjected a great deal of extra code (including <font> tags, <div> tags, and garbage ‘=20′ text). Therefore I recommend NOT using that program.
So you’re sending your emails, and WordPress can read them. But there’s a problem now: since WordPress will publish anything that is sent to that account, how do you test and not mess up your blog?
It turns out that WordPress checks the From: address of emails it reads. If the address matches a User, and that User has permission to publish posts, the posts are immediately published.
But if there is no User with that email, or that User is not permitted to publish, the post goes to ‘Pending Review’ status – like ‘Draft’, it means that it has to be approved before appearing on the blog.
(Note that the From: address also determines who ‘owns’ the post – and if the email doesn’t match an account, it defaults to Admin).
So if you send from an email account that is not set up in your blog (or you temporarily change the User account email addresses so they don’t match), then you can send email after email, and they won’t appear online. However, you can review then from inside Admin (and preview them to see the final result). Once testing is done, set up the proper User email account again, delete the test posts, and you’re ready.
With that out of the way, you can now post a test message, and be ready to actually try email access. To do so, simply view the WordPress page called wp‑mail.php in your blog root. To ease testing, I like to open the page in a new tab in my browser:
http://egwebsite.com/myblog/wp-mail.php
Refreshing this page will repeatedly check your email, and return success, or an error message if something is not set up correctly.
By sending emails to that account and reading them (by refreshing this page manually), you should have your account set up in no time. This is a great way to troubleshoot your account without going crazy, as the error messages wp‑mail.php provide are a real help in explaining problems.
Step 3: WordPress Automatic Checks
Once set up correctly, it’s on to the third part of blogging by email: getting this page automatically checked so WordPress reads the emails.
Note: you don’t have to set up automatic checking – since every time you load wp-mail.php it checks the email, you can simply do that after sending your email off. But of course, if you could do that, you probably could enter your article directly into your blog!
For that, you can download my free plugin to do timing called Utopia Cron at my WordPress plugins page.
This plugin, when activated, uses visitors to your blog to run timed jobs, such as checking your email. To use it, you download, unzip, upload, and activate like any other plugin.
From there, you log into Admin and enter the URL to check (your wp-mail.php file), as well as the time to check. I really don’t think you should check more often than every 30 minutes, or even every hour or two; after all, each check is actually accessing your email system, and some services don’t appreciate you checking too often, or have restrictions.
Putting these three parts together, you now have an account you can send emails to, you’ve tested how to get the emails read and confirmed that they’re being read, and you’ve set up an automatic polling routine to read everything into the blog. All done?
Almost.
There is still one little problem with emails that could drive you crazy – line breaks.
By default, email clients format email text to a certain fixed line length (about 65-75 characters per line). For this reason, if you were to do a post at this point, you’d have problems:
- Line breaks inserted by the email program would be read by WordPress as paragraph breaks – so each LINE would be a PARAGRAPH on the blog.
- Because of this, HTML code tags could be split across lines, and broken – the result would be bizarre looking blog posts, and ruined HTML code, with broken links and other issues.
For that reason, you need one more piece – a custom plugin I wrote to manage the line breaks. Again, install and activate to remove these extra line breaks. It still keeps double line breaks, so just make sure you add a blank line between paragraphs to keep them separate. But it ignores the single ones the email program adds. The result is the email as you expected, including working HTML codes.
Just download the plugin from the Plugins section of ActiveBlogging (Email Line Fix/Utopia41), and install on your blog. The plugin requires no settings or configuration – just activation.
There is an additional option the plugin provides: if you have text that you don’t want published (for instance your signature at the bottom of the email), you can surround the actual article with two tags – this tells the plugin to ignore everything outside of this section. The tags are :start and :end and are used like this:
My email post - this part is NOT used/published. :start This is part of my <b>blog post</b>. Image:<img src="http://egwebsite.com/img.gif" />. A third paragraph - notice extra empty lines. :end This part is NOT published either.
As you can see, your email can include HTML code, including images. However, if you use an image, the file must already be online, with a valid URL.
Combining all this, you end up with an easy system for publishing email posts, that’s simple to use and worry-free once set up. And your emails will create quality posts every time!
[This is an excerpt of an ActiveBlogging Report Article from May 2008 - for the complete article, join ActiveBlogging Platinum today]









Leave your response!