Posted By

DaveChild on 01/28/09


Tagged

email php


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
BrianCoyDesign


PHP Strip Signature from Email


 / Published in: PHP
 

URL: http://www.addedbytes.com

If reading email from a POP box with PHP, you can use this to strip out signatures (ones that are delimited with the proper '--' notation). It will only strip the last signature of an email, in case someone enters a '--' intentionally elsewhere.

  1. function strip_signature($strEmailContent) {
  2. $arrParts = preg_split('/((?:\r|\n|
  3. |\n\r)--\s*(?:\r|\n|
  4. |\n\r))/', $strEmailContent, -1, PREG_SPLIT_DELIM_CAPTURE);
  5. array_pop($arrParts);
  6. array_pop($arrParts);
  7. $strEmailContent = implode('', $arrParts);
  8. return $strEmailContent;
  9. }

Report this snippet  

You need to login to post a comment.