Fix prority between mailboxes and aliases, related to #38
parent
ede346fd84
commit
1e9a8607b0
@ -1,18 +1,21 @@
|
||||
dbpath = /data/freeposte.db
|
||||
query =
|
||||
SELECT destination
|
||||
FROM alias
|
||||
FROM
|
||||
(SELECT destination, email, wildcard, localpart FROM alias
|
||||
UNION
|
||||
SELECT email AS destination, email, 0 as wildcard, localpart FROM user)
|
||||
WHERE
|
||||
(
|
||||
alias.wildcard = 0
|
||||
wildcard = 0
|
||||
AND
|
||||
alias.email = '%s'
|
||||
email = '%s'
|
||||
) OR (
|
||||
alias.wildcard = 1
|
||||
wildcard = 1
|
||||
AND
|
||||
'%s' LIKE alias.email
|
||||
'%s' LIKE email
|
||||
)
|
||||
ORDER BY
|
||||
alias.wildcard ASC,
|
||||
length(alias.localpart) DESC
|
||||
wildcard ASC,
|
||||
length(localpart) DESC
|
||||
LIMIT 1
|
||||
|
Loading…
Reference in New Issue