Skip to content

andrifix/php-reply-trimmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Reply Trimmer

This is a port of the discourse/email_reply_trimmer library. It's a small library to trim replies from plain text email.

Install

Install via Composer:

composer require andrifix/email-reply-trimmer

Usage

To trim replies:

$trimmed_body = EmailReplyTrimmer::trim($email_body);

You can also split the trimmed content and the elided part (the removed reply):

[$trimmedBody, $elidedContent] = EmailReplyTrimmer::trim($emailBody, true);

To extract the first embedded email section:

$extracted = EmailReplyTrimmer::extractEmbeddedEmail($emailBodyWithEmbedded);
if ($extracted) {
    [$embeddedEmail, $beforeEmbedded] = $extracted;
    echo "Text Before Embedded Email: $beforeEmbedded\n";
    echo "Embedded Email $embeddedEmail:\n";
} else {
    echo "No embedded email found.";
}

About

A PHP library to trim email replies, based on @discourse email_reply_trimmer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages