Re: MX/ISP BLOCK

Manvendra Bhangui <[email protected]> Fri, 8 Feb 2019 21:28:58 +0530
Newsgroups gmane.mail.qmail.general
Message-ID <CAOqj+1MUMiAAUhC0TyWTs4ZtNZDapsiwDnbeDrfPN6NKdF4gtw@mail.gmail.com>
On Fri, 8 Feb 2019 at 20:49, Rejaine Silveira Monteiro
<[email protected]> wrote:
>
> Is there any way to temporarily  block or ignore all mails sending
> (qmail-send) to a particular MX (ISP)? There is an internet provider
> in Brazil that is widely used by thousands of customers (locaweb).
> This ISP is off the air and hundreds of messages from multiple clients
> are standing in line. The problem is that this is generating a huge
> delay in delivering to other customers of other ISPs.

You can do something like this temporarily (But test this out on a test system).

1. shutdown down qmail

2. mv /var/qmail/bin/qmail-remote /var/qmail/bin/qmail-remote.org

3. Put the compiled dnsmxip in the qmail-1.03 source directory in /var/qmail/bin

4. Write the following script as qmail-remote in /var/qmail/bin. Asume
w.x.y.z is the IP of the ISP
#!/bin/sh
domain=$1
/var/qmail/bin/dnsmxip $1 |awk '{print $2}'| while read line
do
    if [ " $line" = " w.x.y.z" ] ; then
        exec cat > /dev/null
    fi
done
exec /var/qmail/bin/qmail-remote.org $*

5. chmod +x /var/qmail/bin/qmail-remote
6. Restart qmail