Even though it's an older thread, I wanted to shed some light why Dovecot 
refuses the alias address from Postfix when querying for quotas.

Dovecot's "quota-status" service is supported only in Postfix's 
smtpd_recipient_restrictions phase. If you'd try to use it later, in the 
"smtpd_data_restrictions" phase, the service returned with a permissive DUNNO 
and warned that:

Received policy query from MTA in unexpected state DATA (service can only be 
used for recipient restrictions).

However, Postfix evaluates aliases only _after_ the recipient_restrictions 
phase completed. Even technically, Dovecot couldn't receive the resolved e-mail 
address.

But even in the unsupported DATA state, Postfix doesn't send the resolved 
alias. During the communication between the two services, Postfix sends the 
original e-mail address in the "recipient" attribute to Dovecot, and not the 
resolved alias, although it's now aware of it.

The solution is to do the same alias lookup on Dovecot side, too (as you 
mentioned you did it). An example userdb SQL that handles it:

userdb sql {
    driver = sql
    query = SELECT concat("/var/spool/mail/", maildir) AS home,      \
                  (5000 + id) AS uid,                                \
                  (5000 + id) AS gid,                                \
                  concat(quota, 'B') AS quota_storage_size           \
            FROM mailbox                                             \
            WHERE active = '1'                                       \
              AND (username = '%{user}'                              \
                  OR id IN                                           \
                    (SELECT m2.id                                    \
                      FROM alias                                     \
                      JOIN mailbox m2 ON alias.goto = m2.username    \
                      AND alias.active = 1                           \
                      WHERE alias.address = '%{user}'))

    iterate_query = SELECT username FROM mailbox WHERE active = '1'
}

Ákos
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to