Bounce rules

Discussion in 'Common issues' started by nemesis82, Dec 5, 2018.

  1. nemesis82

    nemesis82 Member

    Joined:
    Sep 19, 2018
    Messages:
    89
    Likes Received:
    13
    S.E:
    2019-09-17 13:35:43
    L.T:
    Regular
    L.C:
    1
    Hi guys,
    I've tried to add an internal custom bounce rule but don't work ,
    Change in :
    .../vendors/BounceHandler/rules.php
    Section :
    'bounceType' => BounceHandler::BOUNCE_INTERNAL,
    'regex' => array(
    Added 2 new rules :
    '/smtp;(\s*)?451 too many messages, slow down. (.*)/i',
    '/smtp;(\s*)?450 (.*) (Recipient address rejected: Policy Rejection- Troppi invii in poco tempo, si prega di ridurre i volumi.)/i',

    I've tried with different regex but all bounce are saved as hard and not as internal .
    Any suggestion where I wrong with my code ?
    Thanks
     
  2. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,125
    Likes Received:
    2,352
    You have to also esc ape the dot: .

    '/smtp;(\s*)?451 too many messages, slow down\. (.*)/i',
    '/smtp;(\s*)?450 (.*) (Recipient address rejected: Policy Rejection- Troppi invii in poco tempo, si prega di ridurre i volumi\.)/i',
     
  3. nemesis82

    nemesis82 Member

    Joined:
    Sep 19, 2018
    Messages:
    89
    Likes Received:
    13
    S.E:
    2019-09-17 13:35:43
    L.T:
    Regular
    L.C:
    1
    Thanks :)
    I'll try and let you known.
     
  4. frm.mwz

    frm.mwz Well-Known Member

    Joined:
    Mar 8, 2016
    Messages:
    3,705
    Likes Received:
    676
    S.E:
    2019-11-27 02:17:39
    L.T:
    Regular
    L.C:
    7
    Can you make those (internal bounce rules) into the standard set of mwz pls.
     
  5. nemesis82

    nemesis82 Member

    Joined:
    Sep 19, 2018
    Messages:
    89
    Likes Received:
    13
    S.E:
    2019-09-17 13:35:43
    L.T:
    Regular
    L.C:
    1
    mmm, not work, threat the bounce always as hard bounce. Below the error code get in blacklist dashboard

    smtp; 451 too many messages, slow down. [smtp-41.local; <mta hostname variable >]

    smtp; 450 4.7.1 <email@address.it>: Recipient address rejected: Policy Rejection- Troppi invii in poco tempo, si prega di ridurre i volumi.
     
  6. frm.mwz

    frm.mwz Well-Known Member

    Joined:
    Mar 8, 2016
    Messages:
    3,705
    Likes Received:
    676
    S.E:
    2019-11-27 02:17:39
    L.T:
    Regular
    L.C:
    7
    I think they should both
    /smtp;(\s*)?451 too many messages, slow down\. (.*)/i',
    '/smtp;(\s*)?450 (.*) (Recipient address rejected: Policy Rejection
    be rules for INTERNAL bounces, not hard bounces.
    Can you make it so, @twisted1919 ?
     
  7. nemesis82

    nemesis82 Member

    Joined:
    Sep 19, 2018
    Messages:
    89
    Likes Received:
    13
    S.E:
    2019-09-17 13:35:43
    L.T:
    Regular
    L.C:
    1
    Hi guys,
    I don't understand in which way I can adjust bounce rules.
    Once I have modified the file rules.php I need to do other stuff to make working the new rules? I have, also, moved from internal to hard some rules but not work and mark as internal ignoring my change.
    Could you let me know?
     
  8. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,125
    Likes Received:
    2,352
    @nemesis82 - if you modify rules.php, at upgrades, mailwizz will overwrite that file.
    Copy the file rules.php into rules-custom-override.php and modify that file as you wish.

    As far as the rules apply, we check the internal bounces first, then soft bounces and then hard bounces, this is also the order how the rules apply, their priority. So if an email matches an internal rule, it will not continue to match against the soft and hard bounces.
     
    nemesis82 and frm.mwz like this.
  9. nemesis82

    nemesis82 Member

    Joined:
    Sep 19, 2018
    Messages:
    89
    Likes Received:
    13
    S.E:
    2019-09-17 13:35:43
    L.T:
    Regular
    L.C:
    1
    ok, thanks twisted. Still a question (last ^^) in which way work file rules.test.php ? Is called from MW or I can use for testing my rules?
    Thanks and, Merry Christmas and happy new year
     
    Last edited: Dec 22, 2018
  10. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,125
    Likes Received:
    2,352
    Oh, that's used by me to test the rules against emails, so you can use it as well if you wish.
    The contents of the file:
    PHP:
    <?php
    /**
    * This tests the corectness of rules!
    */
    // Comment when needed.
    exit('');

    ini_set('display_errors'1);
    error_reporting(-1);

    define('MW_PATH'true);
    require_once 
    dirname(__FILE__) . '/BounceHandler.php';

    $rules  = require dirname(__FILE__) . '/rules.php';
    $string "";
    $string BounceHandler::stripSpecialChars($string);

    $matched= array();

    foreach (
    $rules[BounceHandler::COMMON_RULES] as $info) {
        foreach (
    $info['regex'] as $regex) {
            echo 
    strtoupper($info['bounceType']) . " bounce testing for: {$regex}";
            if (
    preg_match($regex$string$matches)) {
                echo 
    " >>> Matched";
                
    $matched[] = array($regex => $info['bounceType']);
            } else {
                echo 
    " >>> Not matched";
            }
            echo 
    PHP_EOL;
        }
    }
    echo 
    "Matched rules:\n";
    print_r($matched);
    So comment the exit(''); call and then add the string you want to test the rules agains in the $string = ""; variable.
     
    frm.mwz and nemesis82 like this.
  11. nemesis82

    nemesis82 Member

    Joined:
    Sep 19, 2018
    Messages:
    89
    Likes Received:
    13
    S.E:
    2019-09-17 13:35:43
    L.T:
    Regular
    L.C:
    1
    ok, thanks a lot for your support. With tester I have found and solved my issue in bounce processing
     
    twisted1919 likes this.
  12. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,125
    Likes Received:
    2,352

Share This Page