I have an Office 365 account who has multiple folders (mailboxes). With getmail I can retrieve all emails from all mailboxes with the following configuration:
[retriever]
type=SimpleIMAPSSLRetriever
server=<server>
port=<port>
username=<user>
password=<passwd>
mailboxes=ALL
[destination]
type=Mboxrd
path=/var/mail/user
user=<user>
[options]
verbose=0
read_all=false
delete=false
delete_after=0
delete_bigger_than=0
max_bytes_per_session=0
max_message_size=0
max_messages_per_session=0
delivered_to=false
received=false
message_log=/home/user/getmail.log
message_log_syslog=false
message_log_verbose=true
It downloads all emails in /var/mail/user with format mbox. This format is supported by Dovecot 1. My configuration to get these emails from the mbox file and show them via Dovecot server is the following:
disable_plaintext_auth = no
mail_privileged_group = mail
mail_location = mbox:~/:INBOX=/var/mail/%u
ssl = no
protocols = "imap"
listen = 127.0.0.1
userdb {
driver = passwd
}
passdb {
args = %s
driver = pam
}
protocol imap {
}
It works and shows all emails but the problem is that Dovecot does not know what is the mailbox of each email. I have looked in the mbox file, and I have seen that getmail adds the header X-getmail-retrieved-from-mailbox for each email. But when I access to dovecot via IMAP, I see all emails in the INBOX and not in each folder like Office 365. The MUA (Mail User Agent) that I am using is Roundcube. My question is how can I show all folders of Office 365 in Dovecot using getmail and the mbox format.