PHP Classes

PHPMailer Bounce Mail Handler: Handle bounced messages in a IMAP mailbox

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 71%Total: 414 All time: 6,458 This week: 47Up
Version License PHP version Categories
phpmailer-bmh 1.0.11GNU General Publi...5.3Email, PHP 5
Collaborate with this project 

Authors

Andy Prevost
Anthon Pang
Lars Moelleken


Contributor

PHPMailer-BMH - github.com

Description

This package can handle bounced messages in a IMAP mailbox.

It accesses a mailbox via IMAP and retrieves the messages to check if they match one of the several possible rules that define what is a bounced message.

For each matched bounced message it finds, it may invoke a given callback function.

This is package is based on original written by instaclick which in turn is based on WorxWare's PHPMailer-BMH package.

Picture of Lars Moelleken
  Performance   Level  
Innovation award
Innovation award
Nominee: 11x

Winner: 1x

 

Recommendations

Example

<?php

use BounceMailHandler\BounceMailHandler;

/*~ index.php
.---------------------------------------------------------------------------.
| Software: PHPMailer-BMH (Bounce Mail Handler) |
| Version: 5.5-dev |
| Contact: codeworxtech@users.sourceforge.net |
| Info: http://phpmailer.codeworxtech.com |
| ------------------------------------------------------------------------- |
| Author: Andy Prevost andy.prevost@worxteam.com (admin) |
| Copyright (c) 2002-2009, Andy Prevost. All Rights Reserved. |
| ------------------------------------------------------------------------- |
| License: Distributed under the General Public License (GPL) |
| (http://www.gnu.org/licenses/gpl.html) |
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| This is a update of the original Bounce Mail Handler script |
| http://sourceforge.net/projects/bmh/ |
| The script has been renamed from Bounce Mail Handler to PHPMailer-BMH |
| ------------------------------------------------------------------------- |
| We offer a number of paid services: |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'

/*
 * This is an example script to work with PHPMailer-BMH (Bounce Mail Handler).
 */

$time_start = microtime_float();

require_once
'../vendor/autoload.php';

// Use ONE of the following -- all echo back to the screen

//require_once 'callback_echo.php';
//require_once('callback_database.php'); // NOTE: Requires modification to insert your database settings
//require_once('callback_csv.php'); // NOTE: Requires creation of a 'logs' directory and making writable

// testing examples
$bmh = new BounceMailHandler();
$bmh->actionFunction = 'callbackAction'; // default is 'callbackAction'
$bmh->verbose = BounceMailHandler::VERBOSE_SIMPLE; //BounceMailHandler::VERBOSE_SIMPLE; //BounceMailHandler::VERBOSE_REPORT; //BounceMailHandler::VERBOSE_DEBUG; //BounceMailHandler::VERBOSE_QUIET; // default is BounceMailHandler::VERBOSE_SIMPLE
//$bmh->useFetchStructure = true; // true is default, no need to specify
//$bmh->testMode = false; // false is default, no need to specify
//$bmh->debugBodyRule = false; // false is default, no need to specify
//$bmh->debugDsnRule = false; // false is default, no need to specify
//$bmh->purgeUnprocessed = false; // false is default, no need to specify
$bmh->disableDelete = true; // false is default, no need to specify

/*
 * for local mailbox (to process .EML files)
 */
//$bmh->openLocal('/home/email/temp/mailbox');
//$bmh->processMailbox();

/*
 * for remote mailbox
 */
$bmh->mailhost = ''; // your mail server
$bmh->mailboxUserName = ''; // your mailbox username
$bmh->mailboxPassword = ''; // your mailbox password
$bmh->port = 143; // the port to access your mailbox, default is 143
$bmh->service = 'imap'; // the service to use (imap or pop3), default is 'imap'
$bmh->serviceOption = 'notls'; // the service options (none, tls, notls, ssl, etc.), default is 'notls'
$bmh->boxname = 'INBOX'; // the mailbox to access, default is 'INBOX'

//$bmh->moveHard = true; // default is false
//$bmh->hardMailbox = 'INBOX.hardtest'; // default is 'INBOX.hard' - NOTE: must start with 'INBOX.'
//$bmh->moveSoft = true; // default is false
//$bmh->softMailbox = 'INBOX.softtest'; // default is 'INBOX.soft' - NOTE: must start with 'INBOX.'
//$bmh->deleteMsgDate = '2009-01-05'; // format must be as 'yyyy-mm-dd'

/*
 * rest used regardless what type of connection it is
 */
$bmh->openMailbox();
$bmh->processMailbox();

echo
'<hr style="width:200px;" />';
$time_end = microtime_float();
$time = $time_end - $time_start;
echo
'Seconds to process: ' . $time . '<br />';

/**
 * @return float
 */
function microtime_float(): float
{
    list(
$usec, $sec) = \explode(' ', \microtime());

    return (float)
$usec + (float) $sec;
}


Details

Build Status codecov.io Scrutinizer Code Quality Codacy Badge Latest Stable Version Total Downloads Latest Unstable Version License

  • PHP 7.0+ Support
  • Composer & PSR-0 Support
  • PHPUnit testing via Travis CI (TODO: more tests needed)
  • PHP-Quality testing via SensioLabsInsight (TODO: more fixes needed)

Bounce Mail Handler

WARNING: This is a Extended-Fork of instaclick's PHPMailer-BMH what is on the other hand a Fork of WorxWare's PHPMailer-BMH.

Installation

The recommended installation way is through Composer.

$ composer require voku/bounce-mail-handler

Examples

github.com/voku/PHPMailer-BMH/tree/master/examples


  Files folder image Files (275)  
File Role Description
Files folder imageexamples (4 files)
Files folder imagesrc (1 directory)
Files folder imagetests (5 files, 2 directories)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpcs.php_cs Example Example script
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:414
This week:0
All time:6,458
This week:47Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:83%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:71%StarStarStarStar
Rank:216