0

I am using Exim version 4.91. How do I configure it to block outbound emails except for few domains?

Basically, the mail server should only send emails to users on example.com, example.net & example.org. Emails to any other domains have to be blocked.

2

Add a stanza to the beginning of the routers section (order is important, as the first router to match is used):

deny_domains:
  driver = redirect
  domains = ! example.com : ! example.net : ! example.org
  allow_fail
  data = :fail: Mailing is only allowed to example.com, example.net and example.org
  no_more

This router will match other domains than those listed due to the negation exclamation marks, the data :fail: tag indicates that this is a failure.

The no_more directive stops exim trying other routers for the matched domains.

  • 1
    The slightly better approach is to place the restriction into the ACL like acl_rcpt to prevent any further proceeding. Also negation by exclamation mark can be moved to the left like !domains = a : b : c. – Kondybas Sep 10 '18 at 11:26

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.