[Dovecot] Dovecot SQL user_query

Gabriel Millerd gmillerd at gmail.com
Tue May 4 03:06:43 EEST 2010


yes, something akin to this (assuming they are in the same schema) .
sorry i cannot be more helpful with the query. the secret is the
chance to retrieve multiple results, but limiting those results to one
row and having them priroritized mail > users

user_query =  select mail from (select mail from table where email = ?
union select home as mail from users where email = ?) limit 1



On Mon, May 3, 2010 at 6:00 PM, Alex <dovecot at mailswamp.com> wrote:
> Hello folkz,
> Is it possible to setup in dovecot-sql.conf  file to run user_query
> twice if its first run didn't yield any values.
> And likewise don't proceed with the second run if the first user_query
> execution produced the result.
> I have to query two tables which specify there email messages shall be
> delivered via Dovecot deliver LDA
> depending on the incoming email addresses.
>
> Please don't question me about this setup. I inherited this mess from
> the previous Network Admin.
>
> First query should be ran like this:
> user_query = SELECT concat('maildir:/data/mail/',maildir) as mail FROM
> folders WHERE email = '%u'
>
> If the first query doesn't yield any result the second shall be ran like
> this:
> user_query = SELECT maildir as home FROM users WHERE email = '%u'
>
> Please advise if such user_query setup is possible at all.
>
> Thanks in advance,
>
> Alex
>
>
>



-- 
Gabriel Millerd


More information about the dovecot mailing list