[RFCI-Discuss] refusing mail to abuse@ if not the only recipient

Stuart D. Gathman stuart at bmsi.com
Tue Dec 1 13:11:49 GMT 2009


On Mon, 30 Nov 2009, Matus UHLAR - fantomas wrote:

> So, does anyone have a (link to) the code/script/config that could help me
> to temporarily reject either abuse@ or other recipients?

If you just want to unconditionally do so, the sendmail access file will
configure it:

/etc/mail/access:
----------------------8<------------------
localhost.localdomain           RELAY
localhost                       RELAY
127.0.0.1                       RELAY
... etc
From:mailman.sys-con.com        550 5.7.1 Your unsubscribe doesn't work
To:wall.com     550 5.1.6 Out of service
To:abuse at example.com	451 4.7.1 I don't have time for abuse
... etc
----------------------8<------------------

For a python milter, here is an example with none of the sysvinit,
etc, support you would need:

----------------------8<------------------
import Milter

class bmsMilter(Milter.Base):

  ## Provide simple logging to sys.stdout
  def log(self,*msg):
    print 'Milter:',
    for i in msg: print i,
    print

  def envrcpt(self,to,*str):
    # mail to MAILER-DAEMON is generally spam that bounced
    for daemon in ('MAILER-DAEMON','auto-notify'):
      if to.startswith('<%s@'%daemon):
        self.log('REJECT: RCPT TO:',to,str)
        self.setreply('550','5.7.1','%s does not accept mail'%daemon)
        return Milter.REJECT
    if to.lower().startswith('<abuse@'):
      self.log('TEMPFAIL: RCPT TO:',to,str)
      self.setreply('451','4.7.1','I don't have time for abuse')
      return Milter.TEMPFAIL
    self.log("rcpt to",to,str)
    return Milter.CONTINUE

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.


More information about the RFCI-Discuss mailing list