Bounce Mail Handler for PHP | This is a "reboot" of PHPMailer-BMH from WorxWare.

Last update: Mar 25, 2022

Build Status codecov.io Scrutinizer Code Quality Codacy Badge SensioLabsInsight 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

GitHub

https://github.com/voku/PHPMailer-BMH
Comments
  • 1. Custom rules

    One more question, Is it possible to make support custom rules? Like a callback function? maybe callback in function:

    public function processBounce($pos, $type, $totalFetched);
    

    I use composer, and I would like to work with standard rules and had the opportunity to add your own Tnx.

    Reviewed by sedovserge at 2016-11-10 11:12
  • 2. Minor adjustments

    Good morning,

    We are providing some minor corrections that we have found useful in our systems.

    1 - Adding the calls to the functions imap_errors() and imap_alerts() before all thecalls to the function imap_close(). They were originating warnings in our systems.

    More information http://php.net/manual/en/function.imap-alerts.php http://php.net/manual/en/function.imap-errors.php

    2 - Correcting a fatal error originated by passing a wrongly formatted date in the $this->deleteMsgDate parameter.

    3 - Correcting another fatal error on preg_match() when $heades is void.

    We hope you find these fixes useful so they can be added to the master repository.

    Francesc X Escarmís Clickedu Team


    This change is Reviewable

    Reviewed by clickedu-fxescarmis at 2020-06-18 10:12
  • 3. Fixed warning "imap_header(): Bad message number" in the case of moving messages

    If I set move* flags in true (moveSoft and moveHard) and I have more than one message in INBOX than I have PHP warning (after calling processMailbox()):

    PHP Warning 'yii\base\ErrorException' with message 'imap_header(): Bad message number' in /app/vendor/voku/bounce-mail-handler/src/BounceMailHandler/BounceMailHandler.php:691

    Stack trace: #0 /app/vendor/voku/bounce-mail-handler/src/BounceMailHandler/BounceMailHandler.php(536): BounceMailHandler\BounceMailHandler->processBounce()

    The function is stopped in spite of the fact that this warning. So, it brings inconvenience. I tried to solve the problem.


    This change is Reviewable

    Reviewed by ezoterik at 2018-10-21 01:06
  • 4. Fix rule 124

    Add in rules $result['email'] = $match[1]; In callback function param $email is empty without this line

    elseif (preg_match("/<(\[email protected]\S+\w)>.*\n.*mailbox unavailable/i", $body, $match)) {
        $result['rule_cat'] = 'unknown';
        $result['rule_no'] = '124';
        /* HERE */
        $result['email'] = $match[1];
      }
    
    Reviewed by sedovserge at 2016-11-09 22:19
  • 5. Added Gmail Bounce Support To BodyRules

    Added Gmail bounce support to BodyRules. I have tested in my development environment and found no issues, I also tested the regex expression with an online tool against multiple types of bounced emails all from Gmail and the regex has passed for all the emails.


    This change is Reviewable

    Reviewed by JPPreusDev at 2016-10-25 08:46
  • 6. Error in mail parsing

    Hello, There is an issue in email parsing. The regexp in line 492 from file : voku/bounce-mail-handler/src/BounceMailHandler/phpmailer-bmh_rules.php is not correct for specific bounces.

    The following body is detected as an unrecognized bounce :

    This is the mail system at host smtp1.yyyyyyyyy.net.
    
    I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to postmaster.
    
    If you do so, please include this problem report. You can delete your own text from the attached returned message.
    
                       The mail system
    
    <[[email protected]](mailto:[email protected])>: host mx.usgpeople.fr[IP] said: 550
        #5.1.0 Address rejected. (in reply to RCPT TO command)
    

    but the following (quite similar) body is detected as rule '0048' :

    This is the mail system at host smtp2.yyyyyyyyy.net.
    
    I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to postmaster.
    
    If you do so, please include this problem report. You can delete your own text from the attached returned message.
    
                       The mail system
    
    <[[email protected]](mailto:[email protected])>: host mx.usgpeople.fr[IP] said:
        550 #5.1.0 Address rejected. (in reply to RCPT TO command)
    

    The 550 code is not on the same line in the two examples.

    Can you fix the regex, please ? Maybe apply regex on body without carriage return ?

    Thanks for your return,

    Gildas BILLARD

    Reviewed by gbillard-seres at 2022-06-01 12:44
  • 7. Rule broken

    In phpmailer-bmh_rules.php line 1552:
                                                                                                            
      Warning: preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 74  
                                                                                                            
    

    The line in question includes the email address in a preg_match. I suppose, it would need proper regex escaping...

    elseif (preg_match("/Delivery to the following recipients failed.*\n.*\n.*" . $result['email'] . '/i', $dsn_msg)) {

    Reviewed by NerdyProjects at 2019-06-08 17:43
  • 8. Ability to use mailboxLink in derived classes

    Changed visibility of $mailboxLink to be able to interact with mailbox after processing an email. For example if you want an other moving behavior


    This change is Reviewable

    Reviewed by ItsReddi at 2017-11-13 13:06
  • 9. And new rule

    :) Please add one new variation of 0236 rule

    /*
       * rule: unknown
       * sample:
       * <[email protected]>: host mail-host[111.111.111.111]
        said: 550 5.1.1 This user does not exist
       */
      elseif (preg_match("/user.+?not\s+exist/i", $body, $match)) {
        $result['rule_cat'] = 'unknown';
        $result['rule_no'] = '0236';
      }
    
    Reviewed by sedovserge at 2016-11-09 23:08
  • 10. Removing space on folder lookup

    Hey Found a little Bug if you use it with imap an moving true. in line

    if (trim($mailbox) == '' || strpos($mailbox, ' INBOX.') === false) {
    

    The space before INBOX results in a error, because it shouldnt be there.

    Reviewed by ItsReddi at 2015-11-21 09:21
  • 11. Mail not filtered

    Hi, A rule ("unbalanced") is not yet filtered, like this email :

    The original message was received at Wed, 15 Jun 2022 10:00:14 +0200 from [email protected]
    
       ----- The following addresses had permanent fatal errors ----- [[email protected]](mailto:[email protected])>
        (expanded from: [[email protected]](mailto:[email protected])>)
    
       ----- Transcript of session follows -----
    553 5.0.0 [[email protected]](mailto:[email protected])>... Unbalanced '>'
    

    Can you add it please ?

    Thanks a lot,

    Gildas

    Reviewed by gbillard-seres at 2022-06-16 07:37
  • 12. Cannot create imap connection

    hello, i have the following problem, i can't connect with smpt from google. I am using the following configuration:

    $bmh->mailhost = 'smtp.gmail.com'; $bmh->mailboxUserName = 'username'; without @gmail.com $bmh->mailboxPassword = '*****'; $bmh->port = 465; $bmh->service = 'imap'; $bmh->serviceOption = 'ssl/novalidate-cert'; $bmh->boxname = 'INBOX';

    I'm using index.php

    and I get the following error

    Cannot create imap connection to smtp.gmail.com Error MSG: [CLOSED] IMAP connection broken (server response)

    if you can help me!! Thank you!!

    Reviewed by eber22407 at 2022-01-29 21:58
  • 13. More strict php dependency

    Hi folks, as we learned from https://github.com/voku/PHPMailer-BMH/issues/16#issuecomment-961776350, It's extremely risky to depend on "php": ">=7.0.0" since there may be changes in future php versions that (once again) stop this lib from working although composer says that it works with the installed php version.

    I suggest "php": "^7.0|^8.0" (adding the 8.0 assuming https://github.com/voku/PHPMailer-BMH/pull/17 has been merged by the time this issue is viewed).

    Great work guys, keep it up :-)

    Reviewed by siemendev at 2022-01-21 09:49
  • 14. Configure WhiteSource Bolt for GitHub

    Welcome to WhiteSource Bolt for GitHub! This is an onboarding PR to help you understand and configure settings before WhiteSource starts scanning your repository for security vulnerabilities.

    :vertical_traffic_light: WhiteSource Bolt for GitHub will start scanning your repository only once you merge this Pull Request. To disable WhiteSource Bolt for GitHub, simply close this Pull Request.


    What to Expect

    This PR contains a '.whitesource' configuration file which can be customized to your needs. If no changes were applied to this file, WhiteSource Bolt for GitHub will use the default configuration.

    Before merging this PR, Make sure the Issues tab is enabled. Once you merge this PR, WhiteSource Bolt for GitHub will scan your repository and create a GitHub Issue for every vulnerability detected in your repository.

    If you do not want a GitHub Issue to be created for each detected vulnerability, you can edit the '.whitesource' file and set the 'minSeverityLevel' parameter to 'NONE'.


    :question: Got questions? Check out WhiteSource Bolt for GitHub docs. If you need any further assistance then you can also request help here.


    This change is Reviewable

    Reviewed by mend-bolt-for-github[bot] at 2020-12-16 17:00
Related tags
Simple mail sending by PHPMailer and Create your local system.

Simple mail sending by PHPMailer and Create your local system. Send mail zero of cost and also send Attachment like Photo, pdf and multiple files. You should be create a login and verify two steps authentication like OTP, verifications ?? link. PHPMailer make your dreams project eassy and simple also free of cost.

Dec 8, 2021
A mail driver to quickly preview mail
A mail driver to quickly preview mail

A mail driver to quickly preview mail This package can display a small overlay whenever a mail is sent. The overlay contains a link to the mail that w

Aug 8, 2022
PHPMailer – A full-featured email creation and transfer class for PHP
 PHPMailer – A full-featured email creation and transfer class for PHP

PHPMailer – A full-featured email creation and transfer class for PHP Features Probably the world's most popular code for sending email from PHP! Used

Aug 16, 2022
This application (class) does the sending of emails used in the phpmailer library

emailsender - PHP Notification library via email using phpMailer This library has the function of sending email using the phpmailer library. Doing thi

Feb 9, 2022
Crud PHP 8 com Form E-mail
Crud PHP 8 com Form E-mail

Crud com PHP 8 PDO Login - Cadastro de Usuários - Edição - Deleção - Adição | Formulário envio de e-mail Para rodar o Crud é preciso instalar um servi

Nov 16, 2021
:envelope: E-Mail Address Validator (syntax, dns, trash, typo)

✉️ E-Mail Address Validator for PHP Warning The best way to validate an e-mail address is still to send a duplicate opt-in-mail, when the user clicks

Jul 28, 2022
Mail sending module for Mezzio and Laminas MVC with support for file attachment and template email composition
Mail sending module for Mezzio and Laminas MVC with support for file attachment and template email composition

This module provides an easy and flexible way to send emails from Mezzio and Laminas MVC applications (formerly known as Zend Expressive and Zend MVC). It allows you to pre-configure emails and transports, and then send those emails at runtime.

Jan 16, 2022
Laravel Mail Credentials switcher for Budget Laravel Applications

Laravel Mail Switcher Laravel Mail Credentials Switcher is a library which helps you to: Manage your Mail Service Credentials Configure the Laravel's

Aug 6, 2022
PostfixAdmin - web based virtual user administration interface for Postfix mail servers

PostfixAdmin An open source, web based interface for managing domains/mailboxes/aliases etc on a Postfix based mail server.

Aug 13, 2022
Laravel Mail Catcher Driver
 Laravel Mail Catcher Driver

Laravel Mail Catcher Driver This package include a new mailbase driver which will catch all the sent emails and save it to the database. It then expos

Jul 12, 2022
💌 Mail app for Nextcloud
💌 Mail app for Nextcloud

Nextcloud Mail ?? A mail app for Nextcloud Why is this so awesome? ?? Integration with other Nextcloud apps! Currently Contacts, Calendar & Files – mo

Aug 9, 2022
Mail Web is a Laravel package which catches emails locally for debugging
 Mail Web is a Laravel package which catches emails locally for debugging

Mail Web is a Laravel package which catches emails locally for debugging Installation Use the package manager composer to install Mail Web. composer r

Jul 27, 2022
A testing package for intercepting mail sent from Laravel
A testing package for intercepting mail sent from Laravel

Laravel Mail Intercept A testing package for intercepting mail sent from Laravel This testing suite intercepts Laravel Mail just before they are sent

Jul 20, 2022
Mail application developed with Symfony 5

Fakey-Mail Mail application developed with Symfony 5! Check out the requirements for info on how to launch the app. Check out the basic functionality

Jun 21, 2022
✉️ Laravel Mail Explorer
✉️ Laravel Mail Explorer

Mailbook Mailbook is a Laravel package that lets you easily inspect your mails without having to actually trigger it in your application. View demo In

Jul 30, 2022
The classic email sending library for PHP
The classic email sending library for PHP

PHPMailer – A full-featured email creation and transfer class for PHP Features Probably the world's most popular code for sending email from PHP! Used

Aug 11, 2022
Comprehensive mailing tools for PHP
Comprehensive mailing tools for PHP

Swift Mailer Swift Mailer is a component based mailing solution for PHP. It is released under the MIT license. Swift Mailer is highly object-oriented

Aug 13, 2022
An IMAP library for PHP

Fetch Fetch is a library for reading email and attachments, primarily using the POP and IMAP protocols. Installing N.b. A note on Ubuntu 14.04 (probab

Jul 30, 2022
PHP library for parsing plain text email content.

EmailReplyParser EmailReplyParser is a PHP library for parsing plain text email content, based on GitHub's email_reply_parser library written in Ruby.

Jul 27, 2022