Yesterday, I posted my first post via BlackBerry after dealing with a few issues in WordPress that required a little modification to the wp-mail.php file. Seems that HTML emails don’t get through very well. So here are two basic steps to posting via email with your BlackBerry.

Set up your BlackBerry user account as an Author. From the Dashboard, go to Users and add the email account you use on your Blackberry, your name and a different login and password (you won’t really need these as this account is for email posting) and the Role to Author.  Optionally, after you save go back to the new user and set the Display name as your name, so all posts look the same.

Now overwrite your wp-mail.php file with this one.

Here’s the code I changed:

if ($content_type == 'multipart/alternative') {
$content = explode('--'.$boundary, $content);
$content = $content[2];
$content = explode('Content-Transfer-Encoding: quoted-printable', $content);

// BlackBerry Conversion Code
$content = $content[0];
$BODY = strpos($content, '<BODY>');
if ($BODY !== false && $BODY > 0 && $body === false) $content =     substr($content, $BODY);
    $patterns = array ( '/<FONT FACE\=3D\"Verdana, Helvetica, Arial\"><SPAN STYLE\=3D\'font-size\:12\.0px\'>/',
        '/<\/SPAN><\/FONT>/',
        '/\=[\n\r]+/',
        '/<BODY>[\n\r]+/',
        '/<\/BODY>[\n\r]+/',
        '/<HTML>[\n\r]+/',
        '/<\/HTML>[\n\r]+/',
        '/<BR>/');
    $replace = array ('', '', '', '', '', '', '', '<br />');
    $content = preg_replace($patterns, $replace, $content) . '</p>'; // replace and add trailing P tag
    $content = strip_tags($content, '<img><p><br><i><b><u><em><strong><strike><span><div>');
} else if (stripos($content_transfer_encoding, 'quoted-printable') !== false) {
    $content = quoted_printable_decode($content);
}
$content = trim($content);

Try it out, let me know if you have any issues.