Blogging By Email
December 6th, 2006 | Blogging | SetupBlogging by email is an essential feature for me, and I am glad that WP supports this capability , by default.
My first setup involve the following steps:
- Create an email account to receive the post.
- Setup WP to access the account
It turns out that I was missing a couple more steps in order to get a useful Blogging By Email functionality… I ended up doing the following:
- Create an email account to receive the post
- Setup WP
- Enable shell access
- Enable crontab
- Install Postie
Create an Email Account
When I first try to create an email account through DreamHost, it rejected my attempt and ask me to create a mailbox. My past experiences with creating an email account is that it also equates to having a mailbox created, but apparently not so in DreamHost’s tool. It took me a while to find the actual place for mailbox creation at - http://blog.dreamhosters.com/kbase/index.cgi?area=881 (excerpt below):
- …
- Choose an email address for this new mailbox.
- Make sure the “will be delivered to these email addresses” option is selected.
- Also be sure to check off the “deliver to this mailbox:” option.
- Name your new mailbox.
- …
So it was in the same place for creating email address, but I have to explicitly provide the information… Except for this little trouble, once created, it works properly.
Setup WP with the Account
The next step is to setup WP. Under Dashboard > Option > Writing, filling out the details is pretty straight forward, once I track down the necessary information. The only one I have to figure out is the server name - based on http://blog.dreamhosters.com/kbase/index.cgi?area=357, the format is mail.youdomain.com.
Testing…
The next step is to verify the system is working. As shown in the picture, I was able to send an email to this account, however, I refreshed my blog home page multiple times without seeing the new article show up. It turns out that my assumption on the level of email integration is false - I assumed that when enabling the Blog By Email option, refreshing the page would cause an automatic check for new emails. Instead, I would have to setup a cron job - http://wiki.wordpress.org/How%20To%20Blog%20By%20Email.
So time to figure out how to get cron setup with DreamHost
Setting Up Crontab
A quick googling show DreamHost offers shell access and hence allow ability for setting up crontab. However, when I attempt to access my account via SSH gives me an Permission denied error. It turns out that by default shell access is not enabled, and I had to hunt down how to enable my shell access (excerpt below):
- Log into https://panel.dreamhost.com/index.cgi?tree=users.users& to manage your user(s).
- In the right column, click on Edit.
- Click the Shell checkbox to Enable ssh/telnet.
- Click the Save Changes button.
Now I am able to login to the shell and edit my crontab. However, I run into my second permission denied error when running crontab -e.
Googling shows that this is a known issue but require Dreamhost support. And to my surprise, Dreamhost responded to my email request and fixed the problem in 5 minutes! Talking about speedy service!! Good job, DreamHost team!
Adding crontab entry is straight forward…
*/5 * * * * wget http://<server>/<blog_root>/wp-mail.php
And after 5 minutes, my test emails showed up as blog entries! Except… there were some problems…
- It appears that wp-mail does not accept HTML formatted emails - it strips them out
- It appears that wp-mail also does not accept X.400 emails (e.g. Outlook) - seem to keep a MIME header and the plain text
The image showed what happened.
Postie To the Rescue
So - I have to look for a plugin to handle at least HTML formatted emails, if not Outlook emails (I think it would cover Outlook HTML emails if it covers regular HTML emails). And I found Postie. It appears to handle the following:
- Handling HTML emails
- Blog to Categories (yes, multiple)
- Inclusion of images
- Resizing/rotating of images
- Stripping of signatures
I installed and configure based on the directions, and now it handles HTML email fine! This blog you are reading is sent via email. Unfortunately it still does not handle Outlook email appropriately (now it strips out the body instead of keeping it).
Oh well. For now this will suffice for my current blogging usage.

Digg This!
Reddit!
Del.icio.us!
7 responses so far ↓
Thanks,
John
There should be no difference between you running it from inside admin or via wget/curl, because postie AFAIK does not take additional parameters.
What do you mean by sending html as attachments? Are you sending html-enabled email or do you actually attach an html file as attachment in the email and send it?
I have not tried sending html attachments and not sure if postie handles that. To be honest, I have not used postie much because I am somewhat particular about XHTML compliance (and flexibility of CSS), and I couldn’t get the combo of email & postie to create a compliant post
Forgot to mention: if you can post the error you are seeing along with sample email let’s think of it together.
Thank you for taking the time to reply. I should mention that I’m not well versed in the web code arts. I’m more ‘hunt and peck’ than studied. Yes I have been attaching the html files. Postie does allow attached files. Photos, for example display fine.
Perhaps my problem would be solved if I knew more about writing html emails. Because my objective is to embed a YouTube video link- and, while I can add smilies, links, tables and images from my email client (Mac SeaMonkey) that display once emailed to my blog- there’s no option for embedding, or more advanced html (css).
(Is it possible to ‘hand code’ an email? Is there probably a button or a setting I’m missing?)
That said, when I attach an html file that has the YouTube embed code in it- and then activate it by ‘Run Postie’, it shows up fine! But when the cron does it, nada!
Here’s an example of an attached (same problem) swf file. Check out the page source. This email sent- then get_mail run from Postie- “Run Postie”
http://www.trogblog.com/blog/?p=147
This email sent- then let the cron run get_mail.
http://www.trogblog.com/blog/?p=145
When Postie runs get mail the url displayed ends in:
postie/get_mail.php?Submit=Run+Postie+%C2%BB
Whereas the cron curl ends simply in
postie/get_mail.php
Is there a clue in the difference in the urls?
You should know too that when I attach an .flv, .mp4 or a .mov to my email and the cron runs, it works fine! (Thanks to the An-Archos, Anarchy Media Player plug-in).
These MIME types are enabled in the Postie config.
video
text/html
audio/mpeg
video/x-flv
application
text/plain
application/x-shockwave-flash
BTW- I’m running WordPress 2.0.7 (2.1 broke Postie)
PHP 5.1.2
Thanks again. And please don’t feel compelled to dig too deep if, as you say, you’re not much involved with Postie now anywyay.
Best,
JohnH
I went through your samples (all of them), and it seems that you were attaching the videos directly, versus referencing from an attached html. Your google video appears to be a hand crafted html, but the two swf seems to be generated by postie (BTW - the “attach run postie swf” does not appear to work in IE7).
Looking at the html sources, it seems that the one that had problems “failed” somehow, because it only generates partial page (the object/embed part did not get generated and stored).
The one that works (not in IE7) (this looks like generated by postie):
<!–Mime Type of File is application/x-shockwave-flash –><object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0″ width=”" height=”">
<param name=”movie” value=”http://www.trogblog.com/blog/wp-filez/butterfly.swf”>
<param name=”quality” value=”high”> <embed src=”http://www.trogblog.com/blog/wp-filez/butterfly.swf” width=”" height=”" quality=”high” pluginspage=”http://www.macromedia.com/go/getflashplayer” type=”application/x-shockwave-flash” width=”" height=”"></embed> </object>
The one that does not work only has a comment:
<!–Mime Type of File is application/x-shockwave-flash –>
If you were attaching swf directly and run it thru cron, then somehow it got stripped out. If you were attaching email that has the reference strings, then the file you were attaching either were different or got stripped out. When I look through postie source code - it does not just generate the comment, so it must have failed somehow.
It is difficult to discern the reason why it would fail one but not the other, but it seems that you have more successf samples than failures. So perhaps just try again? My guess is that the email crafted weren’t exactly identical, and sometimes postie does not escape things appropriately (see my other article on postie - http://www.yinsochen.com/blog/2006/12/08/postie-sql-injection/). I didn’t know why cron failed until I send the same message and see it fail through “run postie”.
Make sure to craft a new email rather than forwarding an old email, because a forward would cause the previous email to be “attached” and that might be an issue.
Hope this helps. Let me know.
Thanks for your help. I tried a few more things, but I think I’m about at wit’s end. Besides that, there’s a new version of WordPress that Postie doesn’t like, as well as a new version of PHP that seems to be giving people trouble (on the DreamHost servers). I’ll have another go round when things settle down in the next month or so and if I can offer any updates to this thread I will.
Much appreciated! And I’ll be sure to make your blog part of my regular reading.
Best,
John
Yeah that sounds like a great idea. A lot of times it is a combination of many things that causes problems - definitely have to be careful when upgrade to the latest.
Hope to hear good news from you
Leave a Comment