I have sendmail set up to accept mail for a few domains and to relay messages for a few subnets' worth of systems. Recently a particular internal-use-only address has been receiving a lot of spam. I've been asked to simply drop any mail destined for this address unless the mail originated from one of the computers for which this system will relay mail.

I know I can do this with procmail, but I'd prefer to tie it into sendmail so that nonconforming email will be rejected outright at the MTA level. I can't figure out how to get sendmail to do this (or whether it's even possible).

I have sendmail configured with the following settings:

FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')`

/etc/mail/access contains:

example.com              RELAY
connect:192.168.15       OK
to:internal@example.com  REJECT

And I'm generating /etc/mail/access.db via makemap hash /etc/mail/access.db </etc/mail/access.

When I try to use that configuration, however, even local machines get 550 5.2.1 <internal@example.com>... Mailbox disabled for this recipient messages when trying to send to the internal address.

Can I configure sendmail to do what I want and, if so, how?

  • 1) Are you ready for medium level sendmail.cf "programming"? [a few lines] 2) Do you use anti-spam and anti-virus milter(s)? – AnFi Jan 29 '14 at 10:21
  • I've only worked with the M4 sendmail.mc up to now, but I wouldn't be averse to sendmail.cf stuff (as long as it can be embedded in sendmail.mc). We're using one milter: ClamAV. Our anti-spam measures are DNSBLs and Spamassassin (which is called from our LDA). – asciiphil Jan 29 '14 at 14:23

Sorry, I dont want to offend you, but is this the exact content of your /etc/mail/access.db?

example.com              RELAY    
connect:192.168.15       OK    
to:internal@example.com  REJECT

Cause it should be a hash map. The above should be the content of your /etc/mail/access. Then compile it to a map: makemap hash /etc/mail/access.db < /etc/mail/access

| improve this answer | |
  • Sorry; I thought saying "source file" would be clear enough. What I quoted is in /etc/mail/access, which is processed into /etc/mail/access.db via makemap hash /etc/mail/access.db < /etc/mail/access. I'll edit the question to clarify. – asciiphil Jan 27 '14 at 18:54
  • Oh. My bad. Sorry. – Semirke Jan 27 '14 at 19:02
  • Is there a way that works? – Semirke Jan 27 '14 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.