But I’m never quite satisfied with any software — I wanted a few new features, and I wanted a fix for a weird VersaMail bug. So I added some features, and tweaked some code.
This version adds the following:
- Allow uploaded articles to specify status (e.g., draft, publish, static, private).
- Fixes a weird encoding issue introduced by VersaMail, which sends encoded images with a MIME type of “application/octet-stream”. Huh?
- Creates thumbnails of the uploaded images, and includes them as links to the actual images
To specify status for an article, you use John’s subject syntax to specify a category, then follow it up with the code for the status:
- d – draft
- p – publish
- s – static
- P – private
So, for example, to upload an article as a draft into category 6 with a title “My Article”, you would use the subject:
If you’d wanted that to be immediately published instead of posted as a draft, you could just omit the “d” in the category specifier, or explicitly add a “p”.
If you don’t know which category you want, you can still use this status hack; assign the posting to category 1, and change it later from your admin console.
This functionality depends on Thomas Boetell’s popular GD lib being installed. Many PHP installations come with it prebuilt; otherwise you’ll need to bug your ISP to add it (or rebuild your PHP if you run your own server).
By default, thumbnails are created with the maximum dimension of 100 pixels; that means the longest side of the thumbnail will be 100 pixels, regardless of the aspect ratio (if your original image is 640 x 480, the thumbnail will be 100 x 75, but if your original image was 480 x 640, your thumbnail will be 75 x 100). You can change this maximum dimension; simply edit line 49, and change
$thumb_max = 100;
to the value you prefer.
I’m sending my changes to John, so he can incorporate them into whatever he’s doing with wp-mail. In the meantime, you can download ’em here. Simply expand the archive, and replace your wp-mail.php with the file from the archive.