#1448 forum inbound email doesn't work when email has null body

Andy Myers

I've got a tikiwiki v1.8.2 installation with a forum
configured to automatically check a pop3 account for
mail and add any message it finds into the forum as a
message. I believe this is called "inbound mail" in
tikiwiki's code.

When mail is sent to this "dropbox" email address that
has no body, an error occurs. The symptom is that
accessing the forum or any message in the forum results
in a message of the following type being displayed by
my browser:

Array ( [0] => forum [1] => 8 [2] => 1083081138 [3] =>
Anonymous [4] => empty message from VM [5] => [6] =>
31580213fcba06987d20e0b35c972114 [7] => 11 [8] => n [9]
=> [10] => [11] => [12] =>
16526.33167.400740.484132@zamboni.cmcl.cs.cmu.edu [13] => )
$result is false
$result is empty

That's all the page says. I would have expected the
forum to show up.

Having read through the code and added some debugging
printing to the sql_error routine (so that it prints
the full query, not just the values), I think that
what's happening is that around line 324 of
lib/commentslib.php, which is in the function
process_inbound_mail, post_new_comment is being called
with the 'body' variable set to nothing (empty($body)
returns true). Then down around line 1450 or so, when
the mail is inserted into the database, the query
function crashes because the data and hash fields in
the array of values are empty.

The fix I applied is to test body for being empty
before calling post_new_comment, and substituting a
non-empty value for body if it is.

Btw, to repro: many mailers claim they're sending an
empty message, but are actually sending a message with
a blank line or two. Evolution does this. One mailer
I know that truly does send an empty message body is
VM, which is built into xemacs.


  • Sylvie Greverend

    Logged In: YES

    For 1.9 I followed your advice , as I had a notice $body not
    defined but no other error (I use outlook), so I had if body
    not defined body='' . I don't know if it is enough. If A
    1.9+evolution can test ?
    thanks for your comment

  • Damian Parker

    Damian Parker - 2004-08-26
    • status: open --> closed-fixed
  • Andy Myers

    Andy Myers - 2004-09-07

    Logged In: YES

    Hi Sylvie,

    Unfortunately, I don't have the ability to upgrade our tiki
    install to 1.9 since it's a production service that only
    gets upgraded on security warnings. If you had a v1.9
    install around and configured to receive email, I'd be happy
    to try sending an empty message to it.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks