I have a similar rule in my smtpd.conf and it works fine ( I haven't tested 
from command line though). You can turn on debug and see what's in mail.log.

my rule:
accept sender "[email protected]" for any relay via 
smtps+auth://[email protected] auth 
<secrets>------------------------------------------------------------------From:Donovan
 Watteau <[email protected]>Time:2015 Aug 28 (Fri) 16:54To:Joerg Jung 
<[email protected]>Cc:misc <[email protected]>Subject:Re: "From: foo" -> relay 
via $relayA, "From: bar" -> relay via $relayB
2015-08-28 10:13 GMT+02:00 Joerg Jung <[email protected]>:
>
>> On 27 Aug 2015, at 17:27, Donovan Watteau <[email protected]> wrote:
>>
>> Hi,
>>
>> I'm configuring OpenSMTPD 5.7.1p1 on Debian 7.8.
>>
>> I'm looking for something like this:
>>
>>  # Use this when "From: [email protected]" is set:
>>  accept for any relay via $myrelay
>>  # Keep default relay in all other cases:
>>  accept for any relay
>>
>> So, having read smtpd.conf(5), I thought "sender" would be what I'm looking 
>>for:
>>
>>  accept sender "[email protected]" for any relay via $myrelay
>>  accept for any relay
>
> sender expects a table(5) not a single address.

Does it?  I thought putting a string instead of a table implicitly
converts it to a table.

I've seen some examples doing that, and smtpd.conf isn't throwing me a
syntax error.

But anyway, I did try using an explicit table as smtpd.conf(5) suggests:

  table mysender { "[email protected]" }
  accept sender <mysender> for any relay via $myrelay
  accept for any relay

$ echo Test | mail -s Test -a "From: [email protected][email protected]
$ echo Test2 | mail -s Test2 -a "From: [email protected]" -a "Sender:
[email protected][email protected]

But the email doesn't go through $myrelay.  If I remove "sender
<mysender>", it does use $myrelay, but then all the emails coming from
this machine will use $myrelay, and I don't want this.

>> Unfortunately, my email is never relayed through $myrelay, although
>> "From: [email protected]" is set.  Am I misunderstanding what "sender" is
>> about?
>>
>> Then I looked at filter-regex(8) in OpenSMTPD-extras, but I didn't any
>> documentation telling me how to use filter-regex(8) from
>> smtpd.conf(5).  parse.y is a bit rough.
>
> filter-regex can only accept or block messages (based on regex).
> It can not rewrite or change the relay destination, thus will not help you in 
>this case.
>

-- 
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]

Reply via email to