Oops, sorry, "sender_dependent_relayhost_maps” should be “sender_dependent_default_transport_maps” below...
> On Feb 23, 2022, at 2:17 AM, Charles Sprickman <c...@morefoo.com> wrote: > > Hi all, > > I’m having some issues figuring out if this is possible and then if so, how > to approach it. This isn’t for production use, just some internal testing and > experimentation... > > My goal is to set a relay destination based on the SASL username used for > smtp authentication. So if I have users “testsmtp1”, “testsmtp2”, > “testsmtp3”, I’d like to select the relay destination based on that username, > NOT on the envelope From. > > I do have this version of it working, which does use the envelope From. > > In main.cf: > > # enable sasl auth > smtpd_sasl_auth_enable = yes > smtpd_sasl_security_options = noanonymous > smtpd_sasl_authenticated_header = yes > > # map of sender to transport > sender_dependent_relayhost_maps = hash:/usr/local/etc/postfix/relay_by_sender > > In the "relay_by_sender” map file: > > testsmtp1 qmqprelay1 > testsmtp2 qmqprelay2 > testsmtp3 qmqprelay3 > > And in master.cf, the custom transports: > > qmqprelay1 unix - n n - - pipe size=250000 > user=qmqp argv=/usr/local/adm/bin/sendqmqp.pl 10.9.8.200:631 ${sender} > ${recipient} > qmqprelay2 unix - n n - - pipe size=250000 > user=qmqp argv=/usr/local/adm/bin/sendqmqp.pl 10.9.8.200:632 ${sender} > ${recipient} > qmqprelay3 unix - n n - - pipe size=250000 > user=qmqp argv=/usr/local/adm/bin/sendqmqp.pl 10.99.8.200:633 ${sender} > ${recipient} > > In the above configuration, when I connect to relay using any of those > accounts, there is no match and the default transport is used. > > If I add an entry to match the From address, that works fine, as expected. > > So can I do this, but use the SASL username? > > Thanks, > > Charles