Hi Dan, thanks for the pointer

Custom rules are the equivalent of having your head spin through a
tumble-dryer ... but they work:

SLocal_check_rcpt
# check if sender is in local domains
# if yes, accept
# if not, recipient has to be local, else reject
R$*                     $: $1 $| $>3 $&f
R$* $| <>               $@ OK           <> is always ok
R$* $| $*<@$=w.>        $@ OK           u...@local-host-name is ok
R$* $| $*               $: $1           any other user gets checked
R$*                     $: $>3 $1       check recipient
R$+<@$=w.>              $@ OK           recipient local? ok. this seems
to be incoming
R$+<@$+>                $#error $@ 5.1.8 $: "551 Invalid sender domain"

thx /markus

Dan Harnett wrote:
> On Sun, Jun 21, 2009 at 05:42:22PM +0200, Markus Wernig wrote:
>> I have sendmail on 4.4 as MX and relay for outgoing mail using smtp
>> auth. Now some users started using arbitrary from: addresses in their
>> mail clients. I would like to restrict those sender addresses to the
>> local domains, i.e. allow them to send mail from u...@my.domain or
>> u...@my.other.domain, and reject their mails from u...@foreign.domain,
>> preferably during the smtp dialog between MUA and sendmail.
>>
>> I've searched the sendmail docs and google, but can't find how to do
>> this. Is it possible at all?
> 
> Without modifying rulesets or running multiple instances of sendmail, I
> think the simplest way is to use milter-regex.  You can even match the
> authenticated username against specific envelope senders rather than any
> local domain.  Otherwise, you're probably looking at implementing
> something similar to this[1] in your configuration file.
> 
> [1] http://www.sendmail.org/~ca/email/restrict.html

Reply via email to