Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: theshado on August 21, 2012, 08:37:52 PM

Title: message_sent not including body when replying
Post by: theshado on August 21, 2012, 08:37:52 PM
Hey everyone.  I'm hoping somebody can help me out here with an issue I'm having with the message_sent hook.

What I need to do is add the email information into another database table, and to do this I want to implement the "message_sent" method.  It works perfectly when composing a new email, however if I am replying to an email the body is coming in empty.  A quick code excerpt here:

Code: [Select]
  $this->add_hook('message_sent', array($this, 'qualifyEmail'));//Qualify the email

  function qualifyEmail($args)
  {
      $headers = $args['headers'];
      $body = $args['body'];
     
      echo("<script type='text/javascript'>
                alert('BODY: {$body}');
            </script>");
                   
      foreach($headers AS $k => $v)
          echo("<script type='text/javascript'>
                    alert('KEY: {$k}, VALUE: {$v}');
                </script>");
  }

So if I compose a new email, a javascript popup appears saying "BODY: <contents>", and then goes through all of the headers such as to/from/etc. 

If I reply to an email however, body is skipped entirely and it just goes straight to the headers.

Thanks in advance for any help/advice!
Title: Re: message_sent not including body when replying
Post by: alec on August 22, 2012, 02:10:06 AM
Body can be a string or file handle here.