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:
$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!