custom mail_location detection for dovecot lda
Hi!
Is it possible to do something like "post-login scripting" to detect and set a per-user custom mail location for dovecot LDA delivery?
I tried to use a wrapper-script around dovecot-lda that sets the environment variables MAIL="..." and USERDB_KEYS="MAIL" just like overriding userdb fields may be done using imap postlogin scripts, but unfortunately this doesn't seem to be honored. (Also tried with dovecot-lda -k.)
Woud be very useful for slow migration from one mailbox format to another.
Is there any other way to supply a custom mail_location to dovecot-lda?
Cheers, --leo
e-mail ::: Leo.Bergolth (at) wu.ac.at fax ::: +43-1-31336-906050 location ::: IT-Services | Vienna University of Economics | Austria
Op 8-8-2016 om 17:27 schreef Alexander 'Leo' Bergolth:
Hi!
Is it possible to do something like "post-login scripting" to detect and set a per-user custom mail location for dovecot LDA delivery?
I tried to use a wrapper-script around dovecot-lda that sets the environment variables MAIL="..." and USERDB_KEYS="MAIL" just like overriding userdb fields may be done using imap postlogin scripts, but unfortunately this doesn't seem to be honored. (Also tried with dovecot-lda -k.)
Woud be very useful for slow migration from one mailbox format to another.
Is there any other way to supply a custom mail_location to dovecot-lda?
You could use /usr/lib/dovecot/dovecot-lda -omail_location=<location>
There is probably a better way using a userdb though.
Regards,
Stephan.
On 08/08/2016 05:34 PM, Stephan Bosch wrote:
Op 8-8-2016 om 17:27 schreef Alexander 'Leo' Bergolth:
Is it possible to do something like "post-login scripting" to detect and set a per-user custom mail location for dovecot LDA delivery?
You could use /usr/lib/dovecot/dovecot-lda -omail_location=<location>
Thanks for the hint. But it seems to be ignored. :-( I tried it with a .forward of:
| "/usr/libexec/dovecot/dovecot-lda -omail_location=maildir:~/Maildir:LAYOUT=fs"
and postfix logs: ... status=sent (delivered to command: /usr/libexec/dovecot/dovecot-lda -omail_location=maildir:~/Maildir:LAYOUT=fs)
... but it still delivers to the default (mail_location = mbox:~/mail:INBOX=/var/mail/%u)
There is probably a better way using a userdb though.
Per-user configuration with userdb is static, you have to configure the mailbox format for each user. However, if you'd like to give the user the ability to switch between mailbox formats, dynamic detection would be useful...
Cheers, --leo
e-mail ::: Leo.Bergolth (at) wu.ac.at fax ::: +43-1-31336-906050 location ::: IT-Services | Vienna University of Economics | Austria
Op 8-8-2016 om 18:05 schreef Alexander 'Leo' Bergolth:
On 08/08/2016 05:34 PM, Stephan Bosch wrote:
Op 8-8-2016 om 17:27 schreef Alexander 'Leo' Bergolth:
Is it possible to do something like "post-login scripting" to detect and set a per-user custom mail location for dovecot LDA delivery?
You could use /usr/lib/dovecot/dovecot-lda -omail_location=<location> Thanks for the hint. But it seems to be ignored. :-( I tried it with a .forward of:
| "/usr/libexec/dovecot/dovecot-lda -omail_location=maildir:~/Maildir:LAYOUT=fs"
and postfix logs: ... status=sent (delivered to command: /usr/libexec/dovecot/dovecot-lda -omail_location=maildir:~/Maildir:LAYOUT=fs)
... but it still delivers to the default (mail_location = mbox:~/mail:INBOX=/var/mail/%u)
Right, that is overridden. You could use "-onamespace/inbox/location=<location>" instead.
There is probably a better way using a userdb though. Per-user configuration with userdb is static, you have to configure the mailbox format for each user. However, if you'd like to give the user the ability to switch between mailbox formats, dynamic detection would be useful...
http://wiki.dovecot.org/MailLocation#Per-user_mail_locations
Regards,
Stephan.
On 08/08/2016 06:27 PM, Stephan Bosch wrote:
Op 8-8-2016 om 18:05 schreef Alexander 'Leo' Bergolth:
On 08/08/2016 05:34 PM, Stephan Bosch wrote:
Op 8-8-2016 om 17:27 schreef Alexander 'Leo' Bergolth:
Is it possible to do something like "post-login scripting" to detect and set a per-user custom mail location for dovecot LDA delivery?
You could use /usr/lib/dovecot/dovecot-lda -omail_location=<location> Thanks for the hint. But it seems to be ignored. :-( I tried it with a .forward of:
| "/usr/libexec/dovecot/dovecot-lda -omail_location=maildir:~/Maildir:LAYOUT=fs"
and postfix logs: ... status=sent (delivered to command: /usr/libexec/dovecot/dovecot-lda -omail_location=maildir:~/Maildir:LAYOUT=fs)
... but it still delivers to the default (mail_location = mbox:~/mail:INBOX=/var/mail/%u)
Right, that is overridden. You could use "-onamespace/inbox/location=<location>" instead.
Yesss! :-) This one works great for me and is very useful for smooth migration from mbox to maildir:
dovecot-lda.sh: -------------------- 8< -------------------- #!/bin/bash
args=() if [ -d "$HOME/Maildir/INBOX" ]; then args+=("-onamespace/inbox/location=maildir:~/Maildir:LAYOUT=fs") fi exec /usr/libexec/dovecot/dovecot-lda "${args[@]}" "$@" -------------------- 8< --------------------
Thanks for your help!
--leo
e-mail ::: Leo.Bergolth (at) wu.ac.at fax ::: +43-1-31336-906050 location ::: IT-Services | Vienna University of Economics | Austria
participants (2)
-
Alexander 'Leo' Bergolth
-
Stephan Bosch