Skip to content

offlineimap: error: Invalid mailbox name: Ends with hierarchy separator

Source: [remote] Exchange Server via Davmail

Destination: [local] Dovecot

Error in davmail.log :

 Creating folder INBOX.Sales.ShopA.Jack.D.[local]
 ERROR: Creating folder INBOX.Sales.ShopA.Jack.D. on repository local 
  Folder '"INBOX.Sales.ShopNY.Jack.D."'[local] could not be created. 
  Server responded: ('NO', [b'[CANNOT] Invalid mailbox name: 
  Ends with hierarchy separator (0.001 + 0.000 secs).'])

Solution:

Add to Exchange Repository section

[Repository remote]
...
# Remove last '.' in folder name, to prevent error on Dovecot: Invalid mailbox name: Ends with hierarchy separator
nametrans = lambda folder: re.sub('\.$', '',folder)