PHP Strip Signature from Email


/ Published in: PHP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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. }

URL: http://www.addedbytes.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.