RelayTo
in check_rcpt
F{RelayTo} /etc/mail/RelayToto list all hosts you relay mail to or accept mail for, which is used in the ruleset
removelocal
that is called in
check_rcpt
:
Scheck_rcpt ... R$+ $:$>removelocal $1 ...Some people asked for a solution using a map instead of a class (having the usual advantages: no restart of the sendmail daemon necessary etc). Here is a solution (an old version has been posted to comp.mail.sendmail ): Introduce a map like this:
Kisrt dbm -a@RELAYTO /etc/mail/isrtwith entries in the form
allowed.domain RELAYTO(the RHS does not matter in this version.) Next, put this ruleset in your .cf:
Sremovelocal R$*<@$+.>$* $:$1<@$(isrt $2 $:$2.$)>$3 R$*<@$*@RELAYTO>$* $>removelocal $>3 $1 $3 #R$*<@$=w.>$* $:$>removelocal $>3 $1 $3 R$*<@$-.$+.>$* $>removelocal $1<@$3.>$4 R$*<@$*>$* $@ $1<@$2>$3 # dequote local part R$- $: $>3 $(dequote $1 $) R$*<@$*>$* $: $>removelocal $1<@$2>$3
This version does not take entries in class w into account, you have to add them to the map, or you have to enable the rule
R$*<@$=w.>$* $:$>removelocal $>3 $1 $3
removelocal
checks not just for exact match on domains, but also
for subdomains. For example, if you have
subdomain.to RELAYTOin your map, and someone wants to mail to
<user@host.subdomain.to>the ruleset should allow this.