PHP code example of zoon / php-bounce-handler

1. Go to this page and download the library: Download zoon/php-bounce-handler 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/ */

    

zoon / php-bounce-handler example snippets



Zoon\BounceHandler\BounceHandler;

$rawEmail = file_get_contents('eml/1.eml');
$handler = new BounceHandler();
$results = $handler->parse($rawEmail);

foreach ($results as $result) {
	echo $result->emailType->value . PHP_EOL;      // bounce|fbl|autoresponse
	echo $result->action->value . PHP_EOL;         // failed|transient|success|autoresponse
	echo $result->deliveryStatus . PHP_EOL;        // e.g. 5.1.1
	echo $result->recipient . PHP_EOL;
	echo $result->reason->value . PHP_EOL;
}