Skip to content

Instantly share code, notes, and snippets.

@NP-komplett
Created April 3, 2012 12:00
Show Gist options
  • Save NP-komplett/2291393 to your computer and use it in GitHub Desktop.
Save NP-komplett/2291393 to your computer and use it in GitHub Desktop.
<?php
/* Save as custom/modules/InboundEmail/getMessageText.php */
function custom_getMessageText($msgpart) {
if ( $res = preg_match_all("/\<body.*?\>(.*)\<\/body.*?\>/is", $msgpart , $match) > 0 ) {
$GLOBALS['log']->debug("*** custom_getMessageText: Body-tag found");
$bodyhtml = $match[1][0];
$body = strip_tags($bodyhtml);
$GLOBALS['log']->debug("*** custom_getMessageText: Stripped message = $body");
return $body;
} else {
$GLOBALS['log']->debug("*** custom_getMessageText: Body-tag not found");
return $msgpart;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment