igudo.com, wordpress

Blogging on WordPress via email

So if you have been around recently, you’ve noticed some posts with empty bodies. This comes from a WordPress bug that apparently can’t handle leading periods added by my mail server. In case anyone else runs into this problem, namely when you submit a post and the body content fails to show, take a look at this patch for the solution.

All that needs to be done is replacing lines 367-379 of <wp-installation-root>/wp-includes/class-pop3.php with this code:

while ( !ereg("^\.\r\n",$line))
{
$line = fgets($fp,$buffer);
if (preg_match("/^\s+\S+/", $line) && $count > 0)
{
$MsgArray[$count-1] .= $line;
continue;
}
if ((ereg(”^\.\r\n”,$line)) || (empty($line)))
{
break;
}
//Strip any extra leading periods and store the result
if (ereg(”^\.\.”, $line)) {
$MsgArray[$count] = substr($line, 1);
}
else
{
$MsgArray[$count] = $line;
}
$count++;
}
return $MsgArray;