Bounce rules

nemesis82

Active Member
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
 
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',
 
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.
 
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.
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 ?
 
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?
 
@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.
 
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:
in which way work file rules.test.php
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.
 
Hello,

I want to blacklist emails that appear in my INTERNAL bounce list. Were you able to do that? I do not want to enter new rules. I want all the emails in the list to be blacklisted.
 
Hy, from bounce email list you could export all subscribers and then import in blacklist.
Campaigns -> bounce -> export report
Backend -> email blacklist -> import
 
I want to blacklist emails that appear in my INTERNAL bounce list, and I'm okay to update the bounce rules. What file do I need to do?
I'm going to:
Copy the file rules.php into rules-custom-override.php and then move the 100 or so regex

from the block with

'bounceType' => BounceHandler::BOUNCE_INTERNAL

To the block with

'bounceType' => BounceHandler::BOUNCE_HARD

Is this the best way to do it? or could I simply replace BounceHandler::BOUNCE_INTERNAL with BounceHandler::BOUNCE_HARD and have 2 array blocks of BounceHandler::BOUNCE_HARD ?
 
Back
Top