On Fri, Jul 09, 2021 at 07:54:54PM -0400, post...@ptld.com wrote:

> > On 07-09-2021 7:44 pm, Viktor Dukhovni wrote:
> > 
> > You don't need restriction classes for these specific cases,
> > they can be used directly:
> > 
> >     /etc/postfix/recipient_access:
> >          joe@my.domain       permit
> >          jane@my.domain      reject_unknown_sender_domain,
> >                              reject_unknown_client_hostname,
> >                              reject_unknown_helo_hostname
> 
> Thank you, i think that will work.  I assume i can return that from an
> sql query as a single string like
> 
>       SELECT restrictions FROM rules WHERE email=%s
> 
> And in sql the restrictions column can store
> "reject_unknown_sender_domain,reject_unknown_client_hostname"

You can store them comma-separated in a single column, or as
multiple rows, from which you extract a column.  The Postfix
(My|Pg)SQL driver will then automatically join the results with
a ",".

If you want predictable ordering, you may need to also have a
priority column, the PgSQL syntax would be:

    SELECT r
    FROM ( SELECT restriction, priority
           FROM restrictions
           WHERE email = '%s'
           ORDER BY priority
         ) AS T(r, p);

-- 
    Viktor.

Reply via email to