Return to Snippet

Revision: 11201
at January 28, 2009 05:42 by DaveChild


Initial Code
function strip_signature($strEmailContent) {
    $arrParts = preg_split('/((?:\r|\n|
|\n\r)--\s*(?:\r|\n|
|\n\r))/', $strEmailContent, -1, PREG_SPLIT_DELIM_CAPTURE);
    array_pop($arrParts);
    array_pop($arrParts);
    $strEmailContent = implode('', $arrParts);
    return $strEmailContent;
}

Initial URL
http://www.addedbytes.com

Initial Description
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.

Initial Title
PHP Strip Signature from Email

Initial Tags
email, php

Initial Language
PHP