[Dovecot] Default_mail_env..

Chris Wakelin c.d.wakelin at reading.ac.uk
Tue Aug 2 16:56:43 EEST 2005

Guillermo Llenas wrote:
>    Hi,
>          I 'm new to Dovecot and we are trying to do some tests in a
> production environment. We use mysql to authenticate and dovecot imap
> only. But our structure directory is something special.
>    All of ours accounts are stored in maildir and the path is the
> following:
>    For example the account pepe at inter.net
>    /export/maildir/inter.net/p/e/pepe  and into pepe we have cur, tmp, new.
>    This is a problem because we cannot modify the database adding home
> for all users, so in the other side I played with the default_mail_env
> default_mail_env =
> maildir:/export/maildir/%d/%1u/%2u/%n:INBOX=/export/maildir/%d/%1u/%2u/%n 
> but didn't wok out. Because
> imap(pepe at inter.net): Aug 01 18:26:04 Fatal: Failed to create storage
> with data: INBOX=/export/maildir/inter.net/p/pe/pepe
>    I need only export / maildir / domain / first letter of the username
> / second letter / and last username
>    Is there any way to do this ?, thanks in advance

I think ... /%d/%1u/%1.1u/%n ... should work.

>From docs/variables.txt :-

You can take a substring of the variable by giving optional offset
followed by '.' and width after the '%' character. For example %2u gives
first two characters of the username. %2.1u gives third character of the
username. If offset points outside the value, empty string is returned.

So by my reading, "%1u" is the same as "%0.1u", "%2u" is "%0.2u" and you
want "%1.1u"!

Best Wishes,

Christopher Wakelin,                           c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,  Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK              Fax: +44 (0)118 975 3094

More information about the dovecot mailing list