the post-by-email plugin

6 views
Skip to first unread message

mikelietz

unread,
Sep 8, 2009, 12:58:20 AM9/8/09
to habari-dev
So I've been monkeying around with the post by email plugin in -
extras. I didn't write it, I've just been playing around with it since
I updated it to work with 0.6 and trunk.

The 0.6 tagged version functions as much as it had for 0.5, which is
fine for single part messages, but I've been playing around a lot with
trunk, in http://trac.habariproject.org/habari-extras/browser/plugins/pbem/trunk/
to make it a little more capable.

I've heard other people are interested in trying it out, and, well,
it's got a ways to go before it's really usable without some pointers.

First, you don't need to be running an email server to try it out. It
might even work with a POP3 mailbox, though the only one I tried
wasn't connecting.

The difficult part is figuring out the imap_open format.

Mine is {sh118.surpasshosting.com:993/imap/ssl/novalidate-cert} and
that novalidate-cert is important because I couldn't get it to connect
otherwise - I got a Notice about 'Certificate failure' without it. I
got the server (and my credentials) from my host's email account setup/
client configuration page.

But how about we make it easy? You can test this with your current
Gmail account, if you'd like.

First, enable IMAP access in Gmail Settings under Forwarding and POP/
IMAP. This is disabled by default. If you click the Configuration
Instructions there, then go to Other* under Mail Clients, you get what
you need to know.

To help even more, here's what you'd put in the plugins configuration
Mailbox (imap_open format): {imap.gmail.com:993/imap/ssl/} if you want
to post everything in your inbox, or {imap.gmail.com:993/imap/ssl/}
LABEL if you'd rather get just some of them :).

Create a new label in Settings -> Labels (LABEL in the example above)
and then you have a number of options to route messages to that label.
I created a filter for messages sent To: myaccou...@gmail.com to
have the label applied, and skip the inbox.

Then, when the plugin connects, it deals only with the labeled
messages, and deletes only those ones afterward.

So that should be what you'd need to do to try it out.

If you're not seeing the errors, notices, and warnings, I'd recommend
commenting out line 187 ( imap_delete( $mh, $i ); ) first, then using
yoursite.com/admin/pbem to see what's wrong. Also, that's the only
place I found you could see any Utils::debug output if you use some of
the ones I've left in the code, or use any of your own.

Now, for some of what I've found so far.

I emailed a photo from picnik.com, and the email it sent had not only
text/plain but text/html parts. As such, no content made its way into
the postdata. So it should probably handle that sort of email.

Also, I've not really tested it with multiple (image) attachments -
not really sure how or if people would use that anyway, but it should
probably at least handle such without breaking catastrophically.

Lines 111-150 might need some work - other implementations handling
IMAP attachments used recursion, and that might be the case here as
well. What's there now came from http://www.electrictoolbox.com/extract-attachments-email-php-imap/
and probably does more than it needs to.

Error checking and logging are rather nonexistent at present. I've
seen it's possible to get better information from the imap connection,
but I haven't tried adding it in.

The system log message goes through htmlspecialchars (line 185). I
imagine the text can't be used straight out of the email without some
cleanup, but I'm not sure that's the way to do it.

So, try it out! Have some fun! Please make sure you've backed up all
your important emails, and blog content, before trying anything out,
of course. Comments/suggestions/patches welcome.

drzax

unread,
Sep 8, 2009, 2:13:51 AM9/8/09
to habari-dev
I don't have time to contribute myself right now, but I'm super keen
to see how this progresses. Nothing but encouragement from this
corner. It would be super cool to get it to a point where it functions
much like Posterous.

Good luck.

S.

On Sep 8, 2:58 pm, mikelietz <cod...@gmail.com> wrote:
> So I've been monkeying around with the post by email plugin in -
> extras. I didn't write it, I've just been playing around with it since
> I updated it to work with 0.6 and trunk.
>
> The 0.6 tagged version functions as much as it had for 0.5, which is
> fine for single part messages, but I've been playing around a lot with
> trunk, inhttp://trac.habariproject.org/habari-extras/browser/plugins/pbem/trunk/
> to make it a little more capable.
>
> I've heard other people are interested in trying it out, and, well,
> it's got a ways to go before it's really usable without some pointers.
>
> First, you don't need to be running an email server to try it out. It
> might even work with a POP3 mailbox, though the only one I tried
> wasn't connecting.
>
> The difficult part is figuring out the imap_open format.
>
> Mine is {sh118.surpasshosting.com:993/imap/ssl/novalidate-cert} and
> that novalidate-cert is important because I couldn't get it to connect
> otherwise - I got a Notice about 'Certificate failure' without it. I
> got the server (and my credentials) from my host's email account setup/
> client configuration page.
>
> But how about we make it easy? You can test this with your current
> Gmail account, if you'd like.
>
> First, enable IMAP access in Gmail Settings under Forwarding and POP/
> IMAP. This is disabled by default. If you click the Configuration
> Instructions there, then go to Other* under Mail Clients, you get what
> you need to know.
>
> To help even more, here's what you'd put in the plugins configuration
> Mailbox (imap_open format): {imap.gmail.com:993/imap/ssl/} if you want
> to post everything in your inbox, or {imap.gmail.com:993/imap/ssl/}
> LABEL if you'd rather get just some of them :).
>
> Create a new label in Settings -> Labels (LABEL in the example above)
> and then you have a number of options to route messages to that label.
> I created a filter for messages sent To: myaccount+LA...@gmail.com to
> have the label applied, and skip the inbox.
>
> Then, when the plugin connects, it deals only with the labeled
> messages, and deletes only those ones afterward.
>
> So that should be what you'd need to do to try it out.
>
> If you're not seeing the errors, notices, and warnings, I'd recommend
> commenting out line 187 ( imap_delete( $mh, $i ); ) first, then using
> yoursite.com/admin/pbem to see what's wrong. Also, that's the only
> place I found you could see any Utils::debug output if you use some of
> the ones I've left in the code, or use any of your own.
>
> Now, for some of what I've found so far.
>
> I emailed a photo from picnik.com, and the email it sent had not only
> text/plain but text/html parts. As such, no content made its way into
> the postdata. So it should probably handle that sort of email.
>
> Also, I've not really tested it with multiple (image) attachments -
> not really sure how or if people would use that anyway, but it should
> probably at least handle such without breaking catastrophically.
>
> Lines 111-150 might need some work - other implementations handling
> IMAP attachments used recursion, and that might be the case here as
> well. What's there now came fromhttp://www.electrictoolbox.com/extract-attachments-email-php-imap/

eighty4

unread,
Sep 8, 2009, 4:12:52 AM9/8/09
to habari-dev
For this to be extra useful it would be cool if Habari could set up a
mail server for this. Posting to once own email address and having
Habari pull from that feels a bit scary. What if it bugs out and
actuall deletes somethign (not sure if that's actually possible)? I've
not actually looked at the code, but wouldn't you need to store your
email password in Habari? That wouldn't fell good since it can only be
stored "in plain text".
If Habari could write some nice app for this, adding a mail server and
storing peoples Habari account informations encrypted it would be
nice.
> > of course. Comments/suggestions/patches welcome.- Dölj citerad text -
>
> - Visa citerad text -

eternal243

unread,
Sep 8, 2009, 5:59:02 AM9/8/09
to habari-dev
This is indeed an interesting plugin and I would like to try it out,
but do i have to get 0.7 to try it or can I install it on my test-site
where I'm using 0.6.2? Also where do I download it? Do I just copy the
text from the trunk into a new text document on my computer and save
them as .php(or some other file-extension) documents?

Like eighty4 said it would also be a nice feature, maybe optional to
have the plugin install a mail-server for easier configuration.
Encryption was also a good idea.

On Sep 8, 12:58 am, mikelietz <cod...@gmail.com> wrote:
> So I've been monkeying around with the post by email plugin in -
> extras. I didn't write it, I've just been playing around with it since
> I updated it to work with 0.6 and trunk.
>
> The 0.6 tagged version functions as much as it had for 0.5, which is
> fine for single part messages, but I've been playing around a lot with
> trunk, inhttp://trac.habariproject.org/habari-extras/browser/plugins/pbem/trunk/
> to make it a little more capable.
>
> I've heard other people are interested in trying it out, and, well,
> it's got a ways to go before it's really usable without some pointers.
>
> First, you don't need to be running an email server to try it out. It
> might even work with a POP3 mailbox, though the only one I tried
> wasn't connecting.
>
> The difficult part is figuring out the imap_open format.
>
> Mine is {sh118.surpasshosting.com:993/imap/ssl/novalidate-cert} and
> that novalidate-cert is important because I couldn't get it to connect
> otherwise - I got a Notice about 'Certificate failure' without it. I
> got the server (and my credentials) from my host's email account setup/
> client configuration page.
>
> But how about we make it easy? You can test this with your current
> Gmail account, if you'd like.
>
> First, enable IMAP access in Gmail Settings under Forwarding and POP/
> IMAP. This is disabled by default. If you click the Configuration
> Instructions there, then go to Other* under Mail Clients, you get what
> you need to know.
>
> To help even more, here's what you'd put in the plugins configuration
> Mailbox (imap_open format): {imap.gmail.com:993/imap/ssl/} if you want
> to post everything in your inbox, or {imap.gmail.com:993/imap/ssl/}
> LABEL if you'd rather get just some of them :).
>
> Create a new label in Settings -> Labels (LABEL in the example above)
> and then you have a number of options to route messages to that label.
> I created a filter for messages sent To: myaccount+LA...@gmail.com to
> have the label applied, and skip the inbox.
>
> Then, when the plugin connects, it deals only with the labeled
> messages, and deletes only those ones afterward.
>
> So that should be what you'd need to do to try it out.
>
> If you're not seeing the errors, notices, and warnings, I'd recommend
> commenting out line 187 ( imap_delete( $mh, $i ); ) first, then using
> yoursite.com/admin/pbem to see what's wrong. Also, that's the only
> place I found you could see any Utils::debug output if you use some of
> the ones I've left in the code, or use any of your own.
>
> Now, for some of what I've found so far.
>
> I emailed a photo from picnik.com, and the email it sent had not only
> text/plain but text/html parts. As such, no content made its way into
> the postdata. So it should probably handle that sort of email.
>
> Also, I've not really tested it with multiple (image) attachments -
> not really sure how or if people would use that anyway, but it should
> probably at least handle such without breaking catastrophically.
>
> Lines 111-150 might need some work - other implementations handling
> IMAP attachments used recursion, and that might be the case here as
> well. What's there now came fromhttp://www.electrictoolbox.com/extract-attachments-email-php-imap/

Scott Merrill

unread,
Sep 8, 2009, 7:27:46 AM9/8/09
to habar...@googlegroups.com
An SMTP server is a non-trivial thing, and way beyond the scope of any
plugin.

I'd say just create a new GMail account for your post-by-email needs.
Your blog would only check that account, rather than your actual email
account.

Make sure the plugin does some source filtering so that only mail FROM
specified addresses get posted. Maybe it does - I haven't looked.

Cheers,
Scott

mikelietz

unread,
Sep 8, 2009, 8:12:21 AM9/8/09
to habari-dev
@eighty4 Yes, the email account password is stored in plain text.
Encrypting that would be preferable and will presumably be added to a
later version.

I'd also recommend going the Gmail route - I set up an additional
account in a few minutes, and only one or two more to add the label
and split out the inbox.

Currently the plugin does *not* do source filtering - I think that
should probably get added.

@eternal243: the updates to the plugin are in the trunk version of the
plugin which is incompatible with 0.6.2. It can be downloaded from
http://habariproject.org/dist/plugins/pbem.zip or checked out via svn:
http://svn.habariproject.org/habari-extras/plugins/pbem/trunk/

eternal243

unread,
Sep 8, 2009, 8:30:04 AM9/8/09
to habari-dev
Aha, is the version without the changes in the dist/plugin directory
still compatible with 0.6.2 or is that one for 0.7 as well? =)

Another feature that would be nice in the PBEM plugin later is the
possibility to set up posting addresses for different users in case
there are multiple authors on the same blog. Just an idea for
improvement but nothing urgent and ironing the bugs in the original
plugin should definitely be a priority.

On Sep 8, 1:12 pm, mikelietz <cod...@gmail.com> wrote:
> @eighty4 Yes, the email account password is stored in plain text.
> Encrypting that would be preferable and will presumably be added to a
> later version.
>
> I'd also recommend going the Gmail route - I set up an additional
> account in a few minutes, and only one or two more to add the label
> and split out the inbox.
>
> Currently the plugin does *not* do source filtering - I think that
> should probably get added.
>
> @eternal243: the updates to the plugin are in the trunk version of the
> plugin which is incompatible with 0.6.2. It can be downloaded fromhttp://habariproject.org/dist/plugins/pbem.zipor checked out via svn:http://svn.habariproject.org/habari-extras/plugins/pbem/trunk/

mikelietz

unread,
Sep 8, 2009, 12:03:09 PM9/8/09
to habari-dev
The one in /dist/plugins is 0.7 compatible only. If you'd like the
older, 0.6 version (single part email only) you can get it from:
http://trac.habariproject.org/habari-extras/export/2272/plugins/pbem/tags/0.6-0.1/pbem.plugin.php

Also, settings currently are per-user (in userinfo, not site options),
though I have not tested a site with multiple users yet.

Ironing out bugs is definitely a priority :)

mike

eternal243

unread,
Sep 8, 2009, 12:13:36 PM9/8/09
to habari-dev
Thats great, i'll take a look on the trac and get the version for 0.6
to try it out. It is awesome that the settings for multi-author blogs
are already in, even if they haven't been tested much. Thanks for all
the answers! I might try and create a 0.7 site for theme-testing later
and when i do i will try to help out with testing the 0.7 version of
the plugin.

On Sep 8, 5:03 pm, mikelietz <cod...@gmail.com> wrote:
> The one in /dist/plugins is 0.7 compatible only. If you'd like the
> older, 0.6 version (single part email only) you can get it from:http://trac.habariproject.org/habari-extras/export/2272/plugins/pbem/...

mikelietz

unread,
Sep 8, 2009, 8:18:49 PM9/8/09
to habari-dev
I've made some updates. See https://trac.habariproject.org/habari-extras/changeset/2273
wherein I have added a sender whitelist, an option to save the posts
as drafts instead of publishing them, and I'm pretty sure they and the
other options actually work now.

Another @TODO item I keep forgetting to add is .sig removal.

Keep the comments coming!
Reply all
Reply to author
Forward
0 new messages