John Blade’s Homepage

One man on one island.

wp-mail mod update! Now 0.2!

Comments

Thanks for all the feedback for my last wp-mail mod. I’ve done a lot of bug fixing in this release, and added a few features. Still working on improving though, so let me know how you guys go with this version!

Here’s the new version: Thanks for all the feedback for my last wp-mail mod. I’ve done a lot
of bug fixing in this release, and added a few features. Still
working on improving though, so let me know how you guys go with this
version!

Here’s the new version:wp-mail-0.2.zip

<rip from README-wp-mail.php>
Wordpress 1.2 - wp-mail hack
Released 2004-08-26 - Version 0.2
By John B. Hewitt - blade@lansmash.com
Blog: http://blade.lansmash.com

License
-=-=-=-=-=–
It’s GPL! Credits are in the wp-mail.php code.

Introduction
-=-=-=-=-=-=-
This hack is a ‘drop in’ replacement for the current wp-mail.php. It uses pear as a mime compliant email ‘decoder’. What’s cool is that you can attach images inline in your email messages and they’ll be shown as an image in your wordpress article. It does this by decoding the image attachments and writing them to ‘wp-photos’ directory (not in default wp install).

History
-=-=-=-
* Version 0.2 - 2004-08-26
* - Stopped using pear body decoding in favour of own decoding (may be slower but more modifiable) because of enriched text decoding
* - Added base64_decode checking (may help mobile phone users)
* - Fixed Subject line for non-english users (htmlentities instead of just trim)
* - Fixed error in some pop hanging -> more graceful exit on event on no emails in inbox ($pop3->quit)
* - Added work around for email addresses with exta <> in field (ie: <blade@lansmash.com> instead of blade@lasmash.com
* - Added some ===basic=== enriched text support
* - Updated readme file for easier install
* - Easy modify of globals (such as photosdir and filesdir)
* - Cleaned up some pear stuff in install
*
* Version 0.1 - 2004-06-20
* First release (was released under version 1.0 initially, oh boy was I silly)

Features
-=-=-=-=-
It has all the abilities of the current wp-mail.php plus:
- Allows image attachments (posts inline! Main reason I built this mod!!)
- Checks if user email address is in the database (otherwise discards message)
- Allows other file attachments (zip’s, exe’s, etc)
- You can post to various categories (ie, 1 = General)
- Fairly good cleaner for removing excessive line breaks

Would love to see it in the wordpress core
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
I’m planning on more updates, but would love to see this update included in future wordpress releases. Would be happy to maintain it to, I’m fairly sure it complies with most of the coding guidelines I’ve read on
the wordpress coding standard.

Install
-=-=-=-=-
To install you grab the zip file.
- - Drop the two files (wp-mail.php & mailmimedecode.php & PEAR.php) into your wordpress 1.2 root directory
- - Create the directories ‘wp-photos’ and ‘wp-filez’ in the wordpress root directory (with writing permissions (probably 0777).

That’s it. You should now be able to post email to wordpress.

Features to come
-=-=-=-=-=-=-=-=-
Immediate features to come:
- Direct email script that parses email as it comes in (so removes cronjobs)
- GPG/PGP signature verification
- Better enriched text support (only basic stuff at the moment)
- Better security for file attachments (no .php stuff, less l33t hax0rs)
- Look ups for Category posting

Usage
-=-=-=-
You can use the wp-mail hack just like the old wp-mail.

Make sure you change your email client to use HTML encoded messages, that way you’ll get a better looking post that is similar to what you emailed.

When emailing to your blog you can also change the category the post is going to. To do so change the subject line to include [1] at the beginning where one is the number of the category you want to post to.
1 is usually General’s category, so if I want my email to go to the General board I type:
Subject: [1] This is a test

FAQ
-=-
- If you are using Mozilla (thunderbird,etc), use HTML mail! Not HTML/TEXT combined! (One day this script will be able to decode both at the same time, just not today)
- If you are using Outook/Outlook express, use HTML mail!
- If you are using Mac OS X email, you’re sweet
- You can change the default photos and files directories. The variables are on the top of the wp-mail.php code.

Written by JB Hewitt

August 26th, 2004 at 8:50 am

Posted in Code

Viewing 87 Comments