We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

DaveChild on 01/28/09


Tagged

email php


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

umang_nine


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.