Changing the default delivery mailbox to something other than INBOX

Ron Garret ron at flownet.com
Mon Jan 18 08:46:58 EET 2021


I’m looking at the docs here:

https://doc.dovecot.org/configuration_manual/mail_location/

There I see:

> Mailbox autocreation
> 
> Dovecot in the 1.x era created mailboxes automatically regardless of whether mail_location was set. In 2.x autocreation only gets triggered if mail_location is correctly set. You’ll see something like this if you enable debug logging:
> 
>
I’m pretty sure that autocreation is working because the mailbox is in fact being created.  And AFAICT it is being created in the right place with the right permissions.  Despite this, mail delivery is failing when I use INBOX=…

All of the messages disappearing from my client is also mighty hinky.  The only way I can explain that is that dovecot is telling my client that my inbox is no longer named Inobx.  If that is the case then this whole approach won’t work because that will defeat the purpose.  The whole point of this exercise is to get the dovecot LDA to put mail in something OTHER than what the client thinks is the main inbox.

On Jan 17, 2021, at 10:04 PM, Aki Tuomi <aki.tuomi at open-xchange.com> wrote:

> I don't see how that would the obvious way, and that, as you found out, does cause your mails to disappear.
> 
> Looking at `man dovecot-lda` you'll find
> 
> -m mailbox
> 
> Destination  mailbox (default is INBOX). If the mailbox doesn't exist, it will not be created (unless the lda_mailbox_autocreate setting is set to yes). If a message couldn't be saved to the  mailbox for any reason, it's delivered to INBOX instead.
> 
> Aki
> 
>> On 18/01/2021 04:42 Ron Garret <ron at flownet.com> wrote:
>> 
>> 
>> I tried the obvious:
>> 
>> mail_location = maildir:/var/mail/vhosts/%d/%n/mail:INBOX=mail/.Incoming
>> 
>> and that failed in an even more bizarre way.  The Incoming mailbox was created, it showed up in my mail client as it should have, but mail delivery still failed.  Not only that, but all the messages that were in my Inbox disappeared from my mail client.  I reverted the change and all of the messages that had previously been in Inbox reappeared.
>> 
>> WTF?
>> 
>> On Jan 17, 2021, at 5:00 PM, Ron Garret <ron at flownet.com> wrote:
>> 
>>> I groveled around in the docs and discovered the INBOX=… option to the mail_location config parameter.  I tried that, and it didn’t work, but it failed in a very strange way.
>>> 
>>> I currently have:
>>> 
>>> mail_location = maildir:/var/mail/vhosts/%d/%n/mail
>>> 
>>> I tried changing that to:
>>> 
>>> mail_location = maildir:/var/mail/vhosts/%d/%n/mail:INBOX=incoming
>>> 
>>> That failed with the following log message:
>>> 
>>> Jan 17 23:41:17 lmtp(shp at rngh.net)<32476><ruDsCB3LBGDcfgAAa/YOzQ>: Error: Mailbox INBOX: Failed to autocreate mailbox: Permission denied
>>> 
>>> But the weird thing is that it DID create a directory called incoming, and that directory has the same permissions as the rest of the mailbox hierarchy.
>>> 
>>> There is something else which I was not expecting, and that is that the directory is a peer to /var/mail/vhosts/%d/%n/mail.  What I want is to create a folder *inside* /var/mail/vhosts/%d/%n/mail.
>>> 
>>> Advice on how to proceed would be much appreciated.  (BTW, I’d be happy to pay someone a consulting fee for help with this project.  If you’re interested contact me off-list.)
>>> 
>>> rg
>>> 
>>> On Jan 17, 2021, at 12:08 PM, Ron Garret <ron at flownet.com> wrote:
>>> 
>>>> Is there an easy way (i.e. a built-in configuration setting) to change the name of the mailbox that the dovecot LDA delivers mail into?  The default is INBOX but I’d like mail to be delivered to some other mailbox.  The reason for this is that I want all incoming mail to be invisible to the user by default until it has been screened for viruses and spam.  I know I could do this with Sieve, but that is a PITA.
>>>> 
>>>> More details in case anyone is interested:
>>>> 
>>>> The goal of this filter is to make it work with very little training.  To bootstrap the process, the filter is given access to outgoing mail (via a milter) which it uses as a reliable training corpus for good messages.  It then leverages that information to filter incoming messages.  For example, messages from senders which have been the recipients of outgoing messages are presumed to be good.  There is also a spam honeypot to provide a reliable spam corpus.
>>>> 
>>>> One of the heuristics I want to use is to look for the same subject line in multiple messages from unknown users received over a period of an hour or so because those are almost invariably spam.  But that requires a time delay between when a message is received and when it is filtered, and that in turn requires a place to store messages for a while before they are processed.  While they are in that temporary storage, I don’t want them in the user’s face, but I do want them to be accessible if the user wants to see them (e.g. if they know that an important message is coming in which may be stuck in the temp storage).  So I’d like to make something like an INCOMING mailbox where all mail is delivered.  The messages in INCOMING are scanned by the filter and moved to Junk or INBOX as appropriate.
>>>> 
>>>> Thanks,
>>>> rg
>>>> 
>>> 



More information about the dovecot mailing list