HOWTO: Submit Blog post by email

Last modified: May 22, 2008 - 19:45

How to submit Blog post by Email Note, my experiences are for simple email processing. I haven't done anything like tying an email list to a forum.

Step 1: Turn on the mailhandler module

Admin -> Modules
Click on the module

Step 2: Set up an email account to which you will send email

This depends on what you are using for a mail hosting service. I use cpanel, click on Mail , click on Manage/Add/Remove accounts.. Click on Add accounts and set up the email address and the password. For my system, the email can be retrieved as POP3. Again, this depends on the mail hosting service you are using.

Step 3: Configure the mailhandler

Admin -> Mailhandler
Click on Add Mailbox, fill in the appropriate fields.

Email address
Use the email address you set up in step 2 e.g. incoming@example.com. (I have not used the Second email address for my purposes.) In most cases, using INBOX and POP3 for the folder and Mailbox settings should work, again, it depends on your mail service.

Mailbox domain
Should be the domain that you are using. e.g. example.com

Mailbox port
Again, the default of 110 should work, depending on your hosting service.

Mailbox username and password:
Use the userid and password from Step 2, or whatever has been assigned for the email address.

Mime preference
I always simply use HTML. Your choice. Not a biggie.

Security
I leave this disabled. I believe there is enough security with the mail handler as it is. If you do enable it be sure not to use the HTML mime preference.

Send error replies
I like to enable this and leave it enabled, unless I am tying somehow to a mailing list. Even if I am doing that, I would initially have send error replies on until I am sure things are doing what I want.

From header
Again, for personal mail handling, I leave this blank. As noted, you may want to use Sender for mailing lists.

Default commands
This is where I end up doing most of my tweaking. Currently, as an example, I use
type: page
taxonomy: [mail]
promote: 1
format: 3

type: page causes the posts to be page entries. You can also use blog, story, forum, etc.

taxonomy: [mail] I have a taxonomy term called mail for all posts coming in via email. This can be omitted if you don't want to place the entries into a taxonomy category

promote: 1 For the site I'm using, I want email entries to be promoted to the front page. If you don't want them promoted to the front page, omit this line

format: 3 This is my latest tweak to get it so the posts are processed as Full HTML instead of filtered HTML. If you are going to receive HTML email, you really should have this on.

Signature Separator: I leave this blank. This is probably most useful for mail coming from a mailing list that appends some signature stuff, or if you have your own signature file.

Delete Messages after they are processed: Yup. I do that. I don't want the mail box filling up with messages that have already been processed.

cron processing: I generally leave this on.

Step 4: Testing Mail Sending

Once you have the account set up, send an email to the account. Be sure to send it from an email address that has a userid on your site. Otherwise you will get a message something like:

The e-mail address 'tester@example.com' may not create page items.
You sent:
From: tester@example.com

Step 5: Testing the mail retrieval

When the mail has been sent, go to:
Admin -> Mailhandler

You should see the email address under the list. Click on 'retrieve' next to the email address. If everything is working properly, you should get a message something like:

Mailhandler retrieve successful: 1 messages for incoming@example.com

You should then be able to go to and find the message that you submitted at:
Admin -> Content

Assuming this is running properly, all you need to do is make sure that cron is running regularly and emails will be processed as they are received.

security risk?

Mike Sances - October 2, 2007 - 20:13

Thanks for this how-to, this seems really useful! However, assuming you set up your site to automatically receive e-mails from certain e-mails--what's to stop a hacker or spammer from filling out an "Email this page" form on another site (e.g. boston.com or idealist.org) and putting the e-mail address of one of your users as their return address? Wouldn't that allow them to get their content on the site without a password? I know when I use those "Email this page" forms to send things to myself, they appear just as if they come from the return address.

Need both To and From to be correct

mattcbaker - April 27, 2008 - 11:42

Firstly, there are a lot easier ways of sending email "From" specific email addresses - you don't need to use online forms.

Secondly, in order for content to be posted, you need to have knowledge of both the "From" and "To" addresses, which means you need to know:
a) the email address to send posts to (which may or may not be public knowledge - on my site only a few people know this)
b) the email address of a site user with the correct privileges to be able to post content (users email addresses aren't generally made public)

This level of security is good enough for me, but if you are concerned about people guessing / finding out the email addresses then either:
a) Switch on the "require password" option
b) Wait until it becomes a problem, and then switch on the password option.

 
 

Drupal is a registered trademark of Dries Buytaert.