Re: indimail - remote email blocking

2 views
Skip to first unread message

Manvendra Bhangui

unread,
Aug 28, 2023, 3:12:25 AM8/28/23
to Natarajan Mohana Sundaram, indi...@googlegroups.com
On Mon, 28 Aug 2023 at 12:03, Natarajan Mohana Sundaram <mohanasundar...@matrimony.com> wrote:
Now we would like to block the incoming emails from remote domains to these users as well.
Ok 
Do you have any option in the indimail to block the remote incoming emails to specific set of users?
It can be done in many ways

1. You can use envrules to set BADRCPTTO env variables if you want to match on from address. This BADRCPTTO will point to a file which has the specific set of users
2. If you can use ip address match or ip_address not matched, then you can use /etc/indimail/tcp/tcprules.smtp to set BADRCPTTO env variable
3. You can use /etc/indimail/control/rcpt.envrules to set BADMAILFROM to a file which has *. This rejection will happen during delivery and not at SMTP
4. You can use qmail-qfilter to run your own script and read the envelope on descriptor 3 and process all RCPT TO values and exit 100. Or you can simply use the env variable QMAILRCPTS which will have all recipients line by line. If you exit 2, the mail will be blackholed. If you exit 100, the mail will be bounced. In any qmail-qfilter script you can read the envelope by doing
var=`tr ["\0"] ["\n"] 0<&3`

5. You can use the same filterargs you wrote during local delivery to those users instead of during SMTP. You have to edit /etc/indimail/control/filterargs. FILTERARGS will work provided QMAILLOCAL is set to /usr/sbin/spawn-filter
6. You can write your own script which reads descriptor 0 for the mail content, descriptor 1 for envelope and exit 0 and do nothing to blackhole, exit 100 to bounce and simply output stdin to stdout and exit 0 and run qmail-queue with descriptor 1 reading from a file which has the original envelope. You can read envelope in a qmail-queue script by doing
var=`tr ["\0"] ["\n"] 0<&1`

I am trying with filterargs custom script. It is working with single recipient. But script is not working with multiple recipients. With the single recipient, I am simply dropping the email to blackhole. I do not want to edit the original email, hence multiple recipient scenario is not handled in the script.


If you have any better idea, kindly share the same.


Thanks & Regards,
Mohana Sundaram N,
SEDBM - System Engineering & Database Management,
Phone: 044-3095 3095 (Ext: 911), Mobile: +91 99529 66400.
No.94, TVH Beliciaa Towers, 5th Floor, Tower II, MRC Nagar, Chennai - 28.
---------------------------------------------------------------------------------------------------
April 14, Matrimony Day



--
Reply all
Reply to author
Forward
0 new messages