Mailwizz or PMTA Domains Suppression

Hello Mailwizz Fam,

I noticed Mailwizz only has email suppression and not domain suppression function.
And I hope this would be added in future even if it should be available at the backend only.

I have over 14k domains I would love to suppress.

Now my question is,

Does PMTA has function to add domain base suppression and if yes

Does anyone who knows how I can add as high as 14k to PMTA suppression?

I would be glad if anyone can help.

Thanks
 
I noticed Mailwizz only has email suppression and not domain suppression function.
And I hope this would be added in future even if it should be available at the backend only.
You can blacklist entire domains using regex blocking from backend > settings > email blacklist.
 
@Andy Whitlow - I was asking more to provide you a solution :)
There is a hook, called email_blacklist_is_email_blacklisted which is used by all extensions that check emails against remote blacklists, so you could use this as well.
The hook implementation for this looks like:
PHP:
<?php

Yii::app()->hooks->addFilter('email_blacklist_is_email_blacklisted', function($isBlacklisted, $email, $subscriber = null, $customer = null, array $params = []){
    // if already blacklisted we stop
    if ($isBlacklisted !== false) {
        return $isBlacklisted;
    }

    // Load the file with domains in memory, just once per request.
    // If your file size is 10mb, you will need 10mb ram to hold this file
    // This is not effective at all, but if the file is small, it will work just fine
    static $domains;
    if ($domains === null) {
        $domains = [];
        if (is_file(__DIR__ . '/blacklist-domains.txt')) {
            $domains = array_map('strtolower', explode(PHP_EOL, (string)file_get_contents(__DIR__ . '/blacklist-domains.txt')));
        }
    }

    // get the domain from the email address
    list(, $domain) = explode('@', $email);

    // search the domain inside the domains file
    if (array_search(strtolower($domain), $domains) !== false) {
        $isBlacklisted = 'This email address is blacklisted because the domain it belongs to is blacklisted!';
    }

    return $isBlacklisted;
});
This code has to be placed in apps/init-custom.php and assumes in the /apps/ folder you have a file called "blacklist-domains.txt" which contains all the domains, one per line.

As noted above, this is not so efficient, a more efficient approach would be to check a database for the bad domains, but if your file is domains small enough, this will be faster than the database.
 
Lastly, I saw this in the SMTP PMTA info "Make sure the original Message-Id header (header_Message-Id) is included in the payload sent to the webhook endpoint."

Could you please expatiate on this
Code:
Message-Id header (header_Message-Id)
and also give example?

Looking forward to read back from you.

Thanks
 
Back
Top