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: [email protected] 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. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev -~----------~----~----~----~------~----~------~--~---
