[Dovecot] Dovecot SQL user_query

Jerry dovecot.user at seibercom.net
Tue May 4 02:23:47 EEST 2010


On Mon, 03 May 2010 16:00:41 -0700
Alex <dovecot at mailswamp.com> articulated:

> 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.

You probably want to do an "if condition" or similar type query. It has
been ages since I played with MySQL. You might want to read up on the
query syntax.

-- 
Jerry
Dovecot.user at seibercom.net

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the Reply-To header.
__________________________________________________________________

Allen's Axiom:
	When all else fails, read the instructions.


More information about the dovecot mailing list