1

Topic: Delivery to Public folder

==== Required information ====
- iRedMail 0.1.8 and backend LDAP
- Linux CentOS 6.2
====
Hello, collegues.

We created public folder in iRedMail server and it works good. But we want to assign e-mail to this public folder to deliver mail to it directly. How can we do it? What is object in LDAP we have to create for it?
Thanks.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Delivery to Public folder

Create a mail user, then set the maildir path to this public folder.

3

Re: Delivery to Public folder

ZhangHuangbin wrote:

Create a mail user, then set the maildir path to this public folder.

I tried it but in public folder Maildir folder with malbox folders structure is created.

ls -a .nbki
.   cur          dovecot.index.cache  dovecot-keywords  Maildir  tmp
..  dovecot-acl  dovecot.index.log    dovecot-uidlist   new

How could I avoid this situation?

4

Re: Delivery to Public folder

tmp/, cur/, new/ are required by a Maildir mailbox. I'm afraid you cannot avoid them.
Other files start with "dovecot" are created by Dovecot, as the file names shows, they're used for index cache/log, or ACL (IMAP folder sharing), etc.

5 (edited by tikonur 2012-08-31 17:12:00)

Re: Delivery to Public folder

ZhangHuangbin wrote:

tmp/, cur/, new/ are required by a Maildir mailbox. I'm afraid you cannot avoid them.
Other files start with "dovecot" are created by Dovecot, as the file names shows, they're used for index cache/log, or ACL (IMAP folder sharing), etc.

I mean other, I'm sorry.
Look at this

ls -la .nbki
total 60K
drwxr-xr-x 6 vmail vmail 4.0K Aug 30 16:40 .
drwx------ 3 vmail vmail 4.0K Aug 29 22:16 ..
drwxr-xr-x 2 vmail vmail 4.0K Aug 30 10:09 cur
-rw-r--r-- 1 vmail vmail   49 Aug 29 21:20 dovecot-acl
-rw-r--r-- 1 vmail vmail  20K Aug 30 10:09 dovecot.index.cache
-rw-r--r-- 1 vmail vmail 1.9K Aug 30 10:09 dovecot.index.log
-rw-r--r-- 1 vmail vmail   23 Aug 29 21:22 dovecot-keywords
-rw-r--r-- 1 vmail vmail  174 Aug 30 10:09 dovecot-uidlist
drwx------ 9 vmail vmail 4.0K Aug 30 09:52 Maildir
drwxr-xr-x 2 vmail vmail 4.0K Aug 29 20:48 new
drwxr-xr-x 2 vmail vmail 4.0K Aug 30 10:09 tmp

cd .nbki; ls -la Maildir
total 72K
drwx------ 9 vmail vmail 4.0K Aug 30 09:52 .
drwxr-xr-x 6 vmail vmail 4.0K Aug 30 16:40 ..
drwx------ 2 vmail vmail 4.0K Aug 30 05:47 cur
-rw------- 1 vmail vmail    0 Aug 30 05:47 dovecot-acl-list
-rw------- 1 vmail vmail  16K Aug 30 09:52 dovecot.index.cache
-rw------- 1 vmail vmail  468 Aug 30 09:52 dovecot.index.log
-rw------- 1 vmail vmail  120 Aug 30 05:47 dovecot.mailbox.log
-rw------- 1 vmail vmail  175 Aug 30 09:52 dovecot-uidlist
-rw------- 1 vmail vmail    8 Aug 30 05:47 dovecot-uidvalidity
-r--r--r-- 1 vmail vmail    0 Aug 30 05:47 dovecot-uidvalidity.503ec634
drwx------ 5 vmail vmail 4.0K Aug 30 05:47 .Drafts
drwx------ 5 vmail vmail 4.0K Aug 30 05:47 .Junk
drwx------ 2 vmail vmail 4.0K Aug 30 09:52 new
drwx------ 5 vmail vmail 4.0K Aug 30 05:47 .Sent
-rw------- 1 vmail vmail   29 Aug 30 05:47 subscriptions
drwx------ 2 vmail vmail 4.0K Aug 30 09:52 tmp
drwx------ 5 vmail vmail 4.0K Aug 30 05:47 .Trash

Dovecot created folder Maildir with all subfolders in the public folder .nbki as for usual user. How can I prevent creation of folder Maildir? May be delete some attribute in LDAP?

6

Re: Delivery to Public folder

Oh, sorry for my misunderstood.

String "Maildir/" is hard-coded in dovecot.conf and dovecot-ldap.conf, you can remove it if you want, but be careful, it's a global setting, mailboxes of all users will be created without sub-directory "Maildir/". It impacts existing mail accounts also.

7

Re: Delivery to Public folder

ZhangHuangbin wrote:

Oh, sorry for my misunderstood.

String "Maildir/" is hard-coded in dovecot.conf and dovecot-ldap.conf, you can remove it if you want, but be careful, it's a global setting, mailboxes of all users will be created without sub-directory "Maildir/". It impacts existing mail accounts also.

Thanks for your answer. But what can we do with public folders? It seems some new object, not "mail user", has to be created in the LDAP database. Or how can we configure public folder correctly?

8

Re: Delivery to Public folder

tikonur wrote:

Thanks for your answer. But what can we do with public folders? It seems some new object, not "mail user", has to be created in the LDAP database. Or how can we configure public folder correctly?

Confused.

Let's back to your original question:

tikonur wrote:

We created public folder in iRedMail server and it works good. But we want to assign e-mail to this public folder to deliver mail to it directly. How can we do it? What is object in LDAP we have to create for it?

  • What does your "public folder" mean? Is it a shared IMAP folder? Or a directory created with command 'mkdir' directly? If it's a shared IMAP folder, maildir path with "Maildir/" is fine. Reference:

  • How do you "deliver mail to it directly"? Sending an email to this public folder with Outlook/Thunderbird or Roundcube webmail? Then "Maildir/" in maildir path is fine. Otherwise you have to deliver email with command "dovecot-lda" or "deliver" (usually a symbol link to "dovecot-lda"), they're installed in Dovecot directory, not /usr/bin/. Try /usr/libexec/dovecot/ or /usr/local/libexec/dovecot/ instead.

9

Re: Delivery to Public folder

ZhangHuangbin wrote:
tikonur wrote:

Thanks for your answer. But what can we do with public folders? It seems some new object, not "mail user", has to be created in the LDAP database. Or how can we configure public folder correctly?

Confused.

Let's back to your original question:

tikonur wrote:

We created public folder in iRedMail server and it works good. But we want to assign e-mail to this public folder to deliver mail to it directly. How can we do it? What is object in LDAP we have to create for it?

  • What does your "public folder" mean? Is it a shared IMAP folder? Or a directory created with command 'mkdir' directly? If it's a shared IMAP folder, maildir path with "Maildir/" is fine. Reference:

  • How do you "deliver mail to it directly"? Sending an email to this public folder with Outlook/Thunderbird or Roundcube webmail? Then "Maildir/" in maildir path is fine. Otherwise you have to deliver email with command "dovecot-lda" or "deliver" (usually a symbol link to "dovecot-lda"), they're installed in Dovecot directory, not /usr/bin/. Try /usr/libexec/dovecot/ or /usr/local/libexec/dovecot/ instead.

I mean "public folder" in this sense http://wiki2.dovecot.org/SharedMailboxes/Public
Here is part of my dovecot.conf

namespace {
    type = private
    separator = /
    prefix =
    #location defaults to mail_location.
    location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
    inbox = yes
}

namespace {
    type = shared
    separator = /
    prefix = Shared/%%u/
    location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
    # this namespace should handle its own subscriptions or not.
    subscriptions = yes
    list = children
}

namespace {
    type = public
    separator = /
    prefix = Shared folders/
    location = maildir:/home/mail/vmail1/public-folders
    subscriptions = no
    inbox = no
    hidden = no
}

I created folder /home/mail/vmail1/public-folders/.bkzi1 manually.
And I subscribed to bkzi1 without any problem via thunderbird, when I subscribed to bkzi1 I saw following:

ls -l /home/mail/vmail1/public-folders/.bkzi1
total 24K
drwxr-xr-x 2 vmail vmail 4.0K Sep  3 21:46 cur
-rw-r--r-- 1 vmail vmail   49 Sep  3 21:44 dovecot-acl
-rw-r--r-- 1 vmail vmail  248 Sep  3 21:46 dovecot.index.log
-rw-r--r-- 1 vmail vmail   51 Sep  3 21:46 dovecot-uidlist
drwxr-xr-x 2 vmail vmail 4.0K Sep  3 21:46 new
drwxr-xr-x 2 vmail vmail 4.0K Sep  3 21:46 tmp

You can see that /new, /cur and /tmp subfolders are created and I can put some e-mail to bkzi1 manually via thunderbird.
And then I want to do that e-mails addressed to bkzi1@dengabank.ru are putted to the /home/mail/vmail1/public-folders/.bkzi1/new folder.
As you advised I created user bkzi1@dengabank.ru and set in LDAP:
homeDirectory = /home/mail/vmail1/public-folders/.bkzi1
mailMessageStore = vmail1/public-folders/.bkzi1

When I sent e-mail to the bkzi1@dengabank.ru "/home/mail/vmail1/public-folders/.bkzi1/Maildir" folder is created and the e-mail is putted to "/home/mail/vmail1/public-folders/.bkzi1/Maildir/new" folder. But I saw in thunderbird the e-mails that are placed in /home/mail/vmail1/public-folders/.bkzi1/cur folder.

Please, advise, how should I configure dovecot that e-mails are delivered correctly and I could see this e-mails in subscribed folder?
Thank you so much.

10

Re: Delivery to Public folder

Oh, you're right, and i was wrong. Sorry about this.

Did you try to share "/home/mail/vmail1/public-folders/.bkzi1/Maildir/" as public folder? Then you can send email to this mail user directly.

11 (edited by tikonur 2012-09-04 23:46:50)

Re: Delivery to Public folder

ZhangHuangbin wrote:

Oh, you're right, and i was wrong. Sorry about this.

Did you try to share "/home/mail/vmail1/public-folders/.bkzi1/Maildir/" as public folder? Then you can send email to this mail user directly.

I try to do it:

namespace {
    type = public
    separator = /
    prefix = Shared folders/
    location = maildir:/home/mail/vmail1/public-folders/.bkzi1/Maildir
    subscriptions = no
    inbox = no
    hidden = no
}

E-mails are delivered to the /home/mail/vmail1/public-folders/.bkzi1/Maildir/new, but I can't subscribe to the public folder in thunderbird and see strange situation in the thunderbird (see attached picture).

Post's attachments

subscribe.png
subscribe.png 41.35 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

12

Re: Delivery to Public folder

tikonur wrote:

namespace {
    inbox = no
    ...

Do mean cannot subscribe to INBOX? If so, please set "inbox = yes" in namespace {}. Reference: http://wiki2.dovecot.org/Namespaces

http://wiki2.dovecot.org/Namespaces wrote:

inbox: "yes", if this namespace contains the user's INBOX. There is only one INBOX, so only one namespace can have inbox=yes.

13

Re: Delivery to Public folder

... so only one namespace can have inbox=yes.

And if I set as follows
namespace {
    type = public
    separator = /
    prefix = Shared folders/
    location = maildir:/home/mail/vmail1/public-folders/.bkzi1/Maildir
    subscriptions = no
    inbox = yes
    hidden = no
}
I get following error:
Error: user tp28@dengabank.ru: Initialization failed: namespace configuration error: There can be only one namespace with inbox=yes

Dear colleague, please tell me how public folders are usually configured in iRedMail? I think that a standard decision should be.

14

Re: Delivery to Public folder

Oh, sorry, my mistake, as dovecot wiki mentions, "only one namespace can have inbox=yes". Your original namespace setting is fine.

There're (at least) two ways to deliver emails to public IMAP folder directly:

1: Subscribe to this public folder in your Outlook/Thunderbird/Roundcube/etc, then move/copy email you want to share to this public folder.
2: Sent email to an email address, the email will appear in public folder automatically.

For method #2, let's say you want to public a IMAP folder "news", please try below steps:

  • Create a mail user, for example, public@domain.ltd, with maildir path set to "/var/vmail/public/". Dovecot will append "Maildir/" in final maildir path (configured by iRedMail), so all mails sent to public@domain.ltd will be delivered to "/var/vmail/public/Maildir/" by default.

  • Now sent an email to public+news@domain.ltd, it will be delivered to IMAP folder "news" of user public@domain.ltd directly. Note: Dovecot will create IMAP folder "news" automatically.

  • Now add a namespace in dovecot.conf, with maildir location set to "/var/vmail/public/Maildir/".

Let me know whether it works for you or not.

15

Re: Delivery to Public folder

Ok, I'll try it. And I have two question:
1. If I want to create several public folders have I to create new namespace for each?
2. Finally we need to deliver, for example, e-mails for public1@domain.ltd - to public1 folder, e-mails for public2@domain.ltd - to public2 folder, and we need to subscribe to public1, public2 in thunderbird. User shouldn't see any unnecessary folders in the list of subscription (like on picture above, under Shared folders), he should see public1, public2 only. Could you advise how can we to configure such scheme?