PHP code example of bordeux / email-cleaner

1. Go to this page and download the library: Download bordeux/email-cleaner library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bordeux / email-cleaner example snippets


composer 

{
	"bordeux/email-cleaner": "dev-master"
}


use EmailCleaner\EmailCleaner;
    $emailCleaner = new EmailCleaner();
    $simpeEmailHTMLContent = "<your html email code>";
    $emailCleaner->setHTML($simpeEmailHTMLContent);
    $resultHTML = $emailCleaner->parse();
    var_dump($resultHTML); //html only with response to email


use EmailCleaner\EmailCleaner;
use EmailCleaner\FilterAbstract;

class YourCustomFilter extends FilterAbstract {
    public function run() {
        $this->dom->find(".gmail_extra")->remove();
    }
}

    $emailCleaner = new EmailCleaner();
    $emailCleaner->addFilter(new YourCustomFilter());
    
    $simpeEmailHTMLContent = "<your html email code>";
    $emailCleaner->setHTML($simpeEmailHTMLContent);
    $resultHTML = $emailCleaner->parse();
    var_dump($resultHTML); //html only with response to email