Create a separated mailbox for archived mails
Hi,
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my /dovecot-ldap.conf/:
[...]
/ldap_version=3// //auth_bind = yes// //dn = XXX// //dnpass = XXX// //scope = subtree// //user_attrs = sAMAccountName=home=/mnt/mail-storage-dev/%$,=uid=501,=gid=501// //pass_attrs = sAMAccountName=user// //user_filter = (&(objectclass=person)(samaccountname=%n))// //pass_filter= (&(objectclass=person)(samaccountname=%n))/
[...]
I think I will add another conf file, let's say /dovecot-ldap-archive.conf /using "url" as LDAP/AD filed to distinguish from normal users:
[...]
/ldap_version=3// //auth_bind = yes// //dn = XXX// //dnpass = XXX// //scope = subtree// //user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501// //pass_attrs = url=user// //user_filter = (&(objectclass=person)(url=%n))// //pass_filter= (&(objectclass=person)(url=%n))/
[...]
I then added to "test" user a "url" filed into Active Directory named /test-archive//, b/ut it's not working, when I bind Dovecot with:
/doveadm user test-archive/
I receive:
/field value// //userdb lookup: user test-archive doesn't exist/
With test user it works:
/doveadm user test// //field value// //uid 501// //gid 501// //home /mnt/mail-storage-dev/test// //mail maildir:~/Maildir:INDEX=/var/indexes/test/
What I'm doing wrong?
Thanks in advance! //
--
*Claudio Corvino IT Systems Administrator*
I am not really sure what you are trying to realize with this ldap modification. But afaik you have just one mail_location= configuration per user and that is it. If you want to archive email on 2nd storage you can either use this ALT= storage location or create a namespace, and configure this namespace with a new mail_location. The latter I have done indeed as archive, and after every first quarter I am running an auto-archiving script that moves emails from the usual inbox and send folders to the archive namespace.
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my dovecot-ldap.conf:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = sAMAccountName=home=/mnt/mail-storage- dev/%$,=uid=501,=gid=501 pass_attrs = sAMAccountName=user user_filter = (&(objectclass=person)(samaccountname=%n)) pass_filter= (&(objectclass=person)(samaccountname=%n))
[...]
I think I will add another conf file, let's say dovecot-ldap- archive.conf using "url" as LDAP/AD filed to distinguish from normal users:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501 pass_attrs = url=user user_filter = (&(objectclass=person)(url=%n)) pass_filter= (&(objectclass=person)(url=%n))
[...]
I then added to "test" user a "url" filed into Active Directory named test-archive, but it's not working, when I bind Dovecot with:
doveadm user test-archive
I receive:
field value userdb lookup: user test-archive doesn't exist
With test user it works:
doveadm user test field value uid 501 gid 501 home /mnt/mail-storage-dev/test mail maildir:~/Maildir:INDEX=/var/indexes/test
What I'm doing wrong?
Thanks in advance!
--
Claudio Corvino IT Systems Administrator
Hi Marc,
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the /namespace/ with a new /mail_location/ that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the /archive/ namespace.
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails?
Please could you give me some suggestion on how to do that?
Thanks for your time!
Regards
On 17/10/21 12:06, Marc wrote:
I am not really sure what you are trying to realize with this ldap modification. But afaik you have just one mail_location= configuration per user and that is it. If you want to archive email on 2nd storage you can either use this ALT= storage location or create a namespace, and configure this namespace with a new mail_location. The latter I have done indeed as archive, and after every first quarter I am running an auto-archiving script that moves emails from the usual inbox and send folders to the archive namespace.
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my dovecot-ldap.conf:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = sAMAccountName=home=/mnt/mail-storage- dev/%$,=uid=501,=gid=501 pass_attrs = sAMAccountName=user user_filter = (&(objectclass=person)(samaccountname=%n)) pass_filter= (&(objectclass=person)(samaccountname=%n))
[...]
I think I will add another conf file, let's say dovecot-ldap- archive.conf using "url" as LDAP/AD filed to distinguish from normal users:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501 pass_attrs = url=user user_filter = (&(objectclass=person)(url=%n)) pass_filter= (&(objectclass=person)(url=%n))
[...]
I then added to "test" user a "url" filed into Active Directory named test-archive, but it's not working, when I bind Dovecot with:
doveadm user test-archive
I receive:
field value userdb lookup: user test-archive doesn't exist
With test user it works:
doveadm user test field value uid 501 gid 501 home /mnt/mail-storage-dev/test mail maildir:~/Maildir:INDEX=/var/indexes/test
What I'm doing wrong?
Thanks in advance!
--
Claudio Corvino IT Systems Administrator
Hi,
You should be able to configure something like this:
namespace archive { disabled = no hidden = no list = yes prefix = ARCHIVE/ location = sdbox:/archive/location/%u }
Sami
On 20. Oct 2021, at 16.16, Claudio Corvino
mailto:ccorvino@trustitalia.it> wrote: Hi Marc,
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the namespace with a new mail_location that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the archive namespace.
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails?
Please could you give me some suggestion on how to do that?
Thanks for your time!
Regards
On 17/10/21 12:06, Marc wrote:
I am not really sure what you are trying to realize with this ldap modification. But afaik you have just one mail_location= configuration per user and that is it. If you want to archive email on 2nd storage you can either use this ALT= storage location or create a namespace, and configure this namespace with a new mail_location. The latter I have done indeed as archive, and after every first quarter I am running an auto-archiving script that moves emails from the usual inbox and send folders to the archive namespace.
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my dovecot-ldap.conf:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = sAMAccountName=home=/mnt/mail-storage- dev/%$,=uid=501,=gid=501 pass_attrs = sAMAccountName=user user_filter = (&(objectclass=person)(samaccountname=%n)) pass_filter= (&(objectclass=person)(samaccountname=%n))
[...]
I think I will add another conf file, let's say dovecot-ldap- archive.conf using "url" as LDAP/AD filed to distinguish from normal users:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501 pass_attrs = url=user user_filter = (&(objectclass=person)(url=%n)) pass_filter= (&(objectclass=person)(url=%n))
[...]
I then added to "test" user a "url" filed into Active Directory named test-archive, but it's not working, when I bind Dovecot with:
doveadm user test-archive
I receive:
field value userdb lookup: user test-archive doesn't exist
With test user it works:
doveadm user test field value uid 501 gid 501 home /mnt/mail-storage-dev/test mail maildir:~/Maildir:INDEX=/var/indexes/test
What I'm doing wrong?
Thanks in advance!
--
Claudio Corvino IT Systems Administrator
Hi Sami,
thanks for your answer!
Why should I use sdbox?
If I configure the archive location on a NFS mountpoint and I move mails older than 5 years to the "archive", how can I tell client like Thunderbird where to find archived e-mails?
Thanks!
On 20/10/21 15:37, Sami Ketola wrote:
Hi,
You should be able to configure something like this:
namespace archive { disabled = no hidden = no list = yes prefix = ARCHIVE/ location = sdbox:/archive/location/%u }
Sami
On 20. Oct 2021, at 16.16, Claudio Corvino
mailto:ccorvino@trustitalia.it> wrote: Hi Marc,
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the /namespace/ with a new /mail_location/ that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the /archive/ namespace.
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails?
Please could you give me some suggestion on how to do that?
Thanks for your time!
Regards
On 17/10/21 12:06, Marc wrote:
I am not really sure what you are trying to realize with this ldap modification. But afaik you have just one mail_location= configuration per user and that is it. If you want to archive email on 2nd storage you can either use this ALT= storage location or create a namespace, and configure this namespace with a new mail_location. The latter I have done indeed as archive, and after every first quarter I am running an auto-archiving script that moves emails from the usual inbox and send folders to the archive namespace.
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my dovecot-ldap.conf:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = sAMAccountName=home=/mnt/mail-storage- dev/%$,=uid=501,=gid=501 pass_attrs = sAMAccountName=user user_filter = (&(objectclass=person)(samaccountname=%n)) pass_filter= (&(objectclass=person)(samaccountname=%n))
[...]
I think I will add another conf file, let's say dovecot-ldap- archive.conf using "url" as LDAP/AD filed to distinguish from normal users:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501 pass_attrs = url=user user_filter = (&(objectclass=person)(url=%n)) pass_filter= (&(objectclass=person)(url=%n))
[...]
I then added to "test" user a "url" filed into Active Directory named test-archive, but it's not working, when I bind Dovecot with:
doveadm user test-archive
I receive:
field value userdb lookup: user test-archive doesn't exist
With test user it works:
doveadm user test field value uid 501 gid 501 home /mnt/mail-storage-dev/test mail maildir:~/Maildir:INDEX=/var/indexes/test
What I'm doing wrong?
Thanks in advance!
--
Claudio Corvino IT Systems Administrator
Hi,
You can choose what ever storage driver you want. Sdbox was there just as an example that you can have separate storage driver from your mail_location storage driver.
Also this way ARCHIVE shows as normal folder structure under Thunderbird as long as your users subscribe to the folders. Which you can also force with subscribe = auto
Sami
On 20. Oct 2021, at 17.36, Claudio Corvino ccorvino@trustitalia.it wrote:
Hi Sami,
thanks for your answer!
Why should I use sdbox?
If I configure the archive location on a NFS mountpoint and I move mails older than 5 years to the "archive", how can I tell client like Thunderbird where to find archived e-mails?
Thanks!
On 20/10/21 15:37, Sami Ketola wrote:
Hi,
You should be able to configure something like this:
namespace archive { disabled = no hidden = no list = yes prefix = ARCHIVE/ location = sdbox:/archive/location/%u }
Sami
On 20. Oct 2021, at 16.16, Claudio Corvino
mailto:ccorvino@trustitalia.it> wrote: Hi Marc,
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the namespace with a new mail_location that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the archive namespace.
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails?
Please could you give me some suggestion on how to do that?
Thanks for your time!
Regards
On 17/10/21 12:06, Marc wrote:
I am not really sure what you are trying to realize with this ldap modification. But afaik you have just one mail_location= configuration per user and that is it. If you want to archive email on 2nd storage you can either use this ALT= storage location or create a namespace, and configure this namespace with a new mail_location. The latter I have done indeed as archive, and after every first quarter I am running an auto-archiving script that moves emails from the usual inbox and send folders to the archive namespace.
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my dovecot-ldap.conf:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = sAMAccountName=home=/mnt/mail-storage- dev/%$,=uid=501,=gid=501 pass_attrs = sAMAccountName=user user_filter = (&(objectclass=person)(samaccountname=%n)) pass_filter= (&(objectclass=person)(samaccountname=%n))
[...]
I think I will add another conf file, let's say dovecot-ldap- archive.conf using "url" as LDAP/AD filed to distinguish from normal users:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501 pass_attrs = url=user user_filter = (&(objectclass=person)(url=%n)) pass_filter= (&(objectclass=person)(url=%n))
[...]
I then added to "test" user a "url" filed into Active Directory named test-archive, but it's not working, when I bind Dovecot with:
doveadm user test-archive
I receive:
field value userdb lookup: user test-archive doesn't exist
With test user it works:
doveadm user test field value uid 501 gid 501 home /mnt/mail-storage-dev/test mail maildir:~/Maildir:INDEX=/var/indexes/test
What I'm doing wrong?
Thanks in advance!
--
Claudio Corvino IT Systems Administrator
Hi Sami,
I just configured on my test environment (with two Dovecot in replica in geographical different branches) this namespace and it seems to works:
/namespace archive {// // disabled = no// // hidden = no// // inbox = no// // list = yes// // location = maildir:/mnt/mail-storage-archivio/%u-archivio// // subscriptions = yes// // prefix = Archives.// // separator =// //}/
Thanks!
On 20/10/21 16:49, Sami Ketola wrote:
Hi,
You can choose what ever storage driver you want. Sdbox was there just as an example that you can have separate storage driver from your mail_location storage driver.
Also this way ARCHIVE shows as normal folder structure under Thunderbird as long as your users subscribe to the folders. Which you can also force with subscribe = auto
Sami
On 20. Oct 2021, at 17.36, Claudio Corvino
mailto:ccorvino@trustitalia.it> wrote: Hi Sami,
thanks for your answer!
Why should I use sdbox?
If I configure the archive location on a NFS mountpoint and I move mails older than 5 years to the "archive", how can I tell client like Thunderbird where to find archived e-mails?
Thanks!
On 20/10/21 15:37, Sami Ketola wrote:
Hi,
You should be able to configure something like this:
namespace archive { disabled = no hidden = no list = yes prefix = ARCHIVE/ location = sdbox:/archive/location/%u }
Sami
On 20. Oct 2021, at 16.16, Claudio Corvino
mailto:ccorvino@trustitalia.it> wrote: Hi Marc,
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the /namespace/ with a new /mail_location/ that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the /archive/ namespace.
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails?
Please could you give me some suggestion on how to do that?
Thanks for your time!
Regards
On 17/10/21 12:06, Marc wrote:
I am not really sure what you are trying to realize with this ldap modification. But afaik you have just one mail_location= configuration per user and that is it. If you want to archive email on 2nd storage you can either use this ALT= storage location or create a namespace, and configure this namespace with a new mail_location. The latter I have done indeed as archive, and after every first quarter I am running an auto-archiving script that moves emails from the usual inbox and send folders to the archive namespace.
I have an MTA configured with Postfix that deliver email to an IMAP/LMTP Dovecot server version 2.3.4.1 configured to bind LDAP/AD for users.
I would like to configure Dovecot to create another mailbox to archive mails of users to a separated NFS mount.
Here is my dovecot-ldap.conf:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = sAMAccountName=home=/mnt/mail-storage- dev/%$,=uid=501,=gid=501 pass_attrs = sAMAccountName=user user_filter = (&(objectclass=person)(samaccountname=%n)) pass_filter= (&(objectclass=person)(samaccountname=%n))
[...]
I think I will add another conf file, let's say dovecot-ldap- archive.conf using "url" as LDAP/AD filed to distinguish from normal users:
[...]
ldap_version=3 auth_bind = yes dn = XXX dnpass = XXX scope = subtree user_attrs = url=home=/mnt/mail-storage-archive/%$,=uid=501,=gid=501 pass_attrs = url=user user_filter = (&(objectclass=person)(url=%n)) pass_filter= (&(objectclass=person)(url=%n))
[...]
I then added to "test" user a "url" filed into Active Directory named test-archive, but it's not working, when I bind Dovecot with:
doveadm user test-archive
I receive:
field value userdb lookup: user test-archive doesn't exist
With test user it works:
doveadm user test field value uid 501 gid 501 home /mnt/mail-storage-dev/test mail maildir:~/Maildir:INDEX=/var/indexes/test
What I'm doing wrong?
Thanks in advance!
--
Claudio Corvino IT Systems Administrator
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the namespace with a new mail_location that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the archive namespace.
Indeed and if you are choosing a period of 5 years you can just run it at the end of the year. I do this every year, so I decided to do it after the first quarter. I have inbox stored on ssd and archive on hdd. (I have some users that have >80GB mail????). I decided to enable this for specific users by creating an autoarchive sieve entry. My cron job script checks which users are having these and then moves the email. I also decided to control to have this done within specific down hours, so there is no moving done during 'working hours'. I also made an array of folders to move like common Inbox and Sent Items (yes these are also getting big), and move these all to a specific year. Apple mail is even so smart to link inbox emails to archived folders mails in thread view.
This is what you need to build your script around: doveadm move -u $account Archive/$year mailbox "$mbox" SENTBEFORE $nyear-01-01 SENTSINCE $year-01-01
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails?
Clients will just see these folders. Maybe you need to add subscriptions = yes to the configuration.
Thanks Marc!
I just configured a namespace for archive on a different storage, now I have to decide if e-mail archiving will be accomplished manually by Thunderbird users or by a cronjob like you suggested me.
On 20/10/21 18:49, Marc wrote:
thanks for replying, I would like to archive e-mail older than 5 years on a second storage, it seems like the namespace with a new mail_location that you suggested could be good for me, but then I will need the auto-archiving script that move mails older than 5 years to the archive namespace. Indeed and if you are choosing a period of 5 years you can just run it at the end of the year. I do this every year, so I decided to do it after the first quarter. I have inbox stored on ssd and archive on hdd. (I have some users that have >80GB mail????). I decided to enable this for specific users by creating an autoarchive sieve entry. My cron job script checks which users are having these and then moves the email. I also decided to control to have this done within specific down hours, so there is no moving done during 'working hours'. I also made an array of folders to move like common Inbox and Sent Items (yes these are also getting big), and move these all to a specific year. Apple mail is even so smart to link inbox emails to archived folders mails in thread view.
This is what you need to build your script around: doveadm move -u $account Archive/$year mailbox "$mbox" SENTBEFORE $nyear-01-01 SENTSINCE $year-01-01
A question: how can I configure client like Thunderbird to access that archive namespace so that users can still access their old mails? Clients will just see these folders. Maybe you need to add subscriptions = yes to the configuration.
participants (4)
-
Claudio Corvino
-
dovecot@ptld.com
-
Marc
-
Sami Ketola