Author Topic: message_sent not including body when replying  (Read 1654 times)

Offline theshado

  • Newbie
  • *
  • Posts: 3
message_sent not including body when replying
« 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}');
      foreach($headers AS $k => $v)
          echo("<script type='text/javascript'>
                    alert('KEY: {$k}, VALUE: {$v}');

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!

Offline alec

  • Hero Member
  • *****
  • Posts: 1,202
Re: message_sent not including body when replying
« Reply #1 on: August 22, 2012, 02:10:06 AM »
Body can be a string or file handle here.