A
A
aroun2016-04-28 06:23:13
linux
aroun, 2016-04-28 06:23:13

How to filter outgoing domains in Exim?

Colleagues, I ask for help.
It is necessary to filter some domains when sending, from the list, I use the following construction:

check_outgoing:
driver = redirect
domains = ! +local_domains
senders = *@lsearch;/etc/exim4/sender_reject.list
allow_fail = yes
data = :fail: You can not send mail from this mailbox from this server.

Here is the list itself:
cat /etc/exim4/sender_reject.list
gmail.com
mail.ru
yandex.ru

I run the test:
exim -bt -d-resolver [email protected]
Testing [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email protected]
--------> check_outgoing router <--------
local_part=kirkorn domain=yandex.ru
checking domains
yandex.ru in "@:localhost"? no (end of list)
yandex.ru in "! +local_domains"? yes (end of list)
checking senders
address match: [email protected] pattern=*@lsearch;/etc/exim4/sender_reject.list
search_open: lsearch "/etc/exim4/sender_reject.list"
search_find: file="/etc/exim4/sender_reject.list"
  key="worker.yandex.ru" partial=-1 affix=NULL starflags=0
LRU list:
  :/etc/exim4/sender_reject.list
  End
internal_search_find: file="/etc/exim4/sender_reject.list"
  type=lsearch key="worker.yandex.ru"
file lookup required for worker.yandex.ru
  in /etc/exim4/sender_reject.list
lookup failed
worker.yandex.ru in "lsearch;/etc/exim4/sender_reject.list"? no (end of list)
[email protected] in "*@lsearch;/etc/exim4/sender_reject.list"? no (end of list)
check_outgoing router skipped: senders mismatch

If you add worker.yandex.ru to the list, it will be filtered out:
Testing [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email protected]
--------> check_outgoing router <--------
local_part=kirkorn domain=yandex.ru
checking domains
yandex.ru in "@:localhost"? no (end of list)
yandex.ru in "! +local_domains"? yes (end of list)
checking senders
address match: [email protected] pattern=*@lsearch;/etc/exim4/sender_reject.list
search_open: lsearch "/etc/exim4/sender_reject.list"
search_find: file="/etc/exim4/sender_reject.list"
  key="worker.yandex.ru" partial=-1 affix=NULL starflags=0
LRU list:
  :/etc/exim4/sender_reject.list
  End
internal_search_find: file="/etc/exim4/sender_reject.list"
  type=lsearch key="worker.yandex.ru"
file lookup required for worker.yandex.ru
  in /etc/exim4/sender_reject.list
lookup yielded:
worker.yandex.ru in "lsearch;/etc/exim4/sender_reject.list"? yes (matched "lsearch;/etc/exim4/sender_reject.list")
[email protected] in "*@lsearch;/etc/exim4/sender_reject.list"? yes (matched "*@lsearch;/etc/exim4/sender_reject.list")
calling check_outgoing router
rda_interpret (string): :fail: You can not send mail from this mailbox from this server.
expanded: :fail: You can not send mail from this mailbox from this server.
file is not a filter file
parse_forward_list: :fail: You can not send mail from this mailbox from this server.
extract item: :fail: You can not send mail from this mailbox from this server.
check_outgoing router forced address failure
[email protected] is undeliverable: You can not send mail from this mailbox from this server.
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=12481 terminating with rc=2 >>>>>>>>>>>>>>>>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question