offlineimap icon indicating copy to clipboard operation
offlineimap copied to clipboard

Offline imap attempts to delete messages on synchronization

Open rom1v opened this issue 2 years ago • 1 comments

General informations

  • system/distribution (with version): Debian sid
  • offlineimap version (offlineimap -V): 8.0.0
  • Python version: 3.11.2
  • server name or domain: my own domain
  • CLI options: offlineimap -c offlineimaprc

Configuration file offlineimaprc

[general]
accounts = XXXXX

[Account XXXXX]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = Maildir
localfolders = /my/backup/folder

[Repository Remote]
type = IMAP
remotehost = ...
remoteuser = ...
remotepassfile = ...
ssl = yes
cert_fingerprint = ...

Logs, error

Apparently, it attempts to delete messages on synchronization (I have this error for all special folders). I use it for backup purpose, it should not even try to write/delete messages.

 Deleting 8 messages (32921:32928) in IMAP[Sent]
 Attempted to modify flags for messages [32921, 32922, 32923, 32924, 32925, 32926, 32927, 32928] in folder IMAP[Sent], but that folder is read-only.  No flags have been modified for that message.
 ERROR: while syncing Sent [account XXXXX]
  mailbox status changed to READ-ONLY
 ERROR: ERROR in syncfolder for XXXXX folder Sent: Traceback (most recent call last):
  File "/usr/share/offlineimap3/offlineimap/accounts.py", line 666, in syncfolder
    localfolder.syncmessagesto(remotefolder, statusfolder)
  File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 1164, in syncmessagesto
    action(dstfolder, statusfolder)
  File "/usr/share/offlineimap3/offlineimap/folder/Base.py", line 1029, in __syncmessagesto_delete
    dstfolder.deletemessages(deletelist)
  File "/usr/share/offlineimap3/offlineimap/folder/IMAP.py", line 1074, in deletemessages
    self.__deletemessages_noconvert(uidlist)
  File "/usr/share/offlineimap3/offlineimap/folder/IMAP.py", line 1089, in __deletemessages_noconvert
    assert (imapobj.expunge()[0] == 'OK')
            ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 794, in expunge
    return self._simple_command(name, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 1684, in _simple_command
    return self._command_complete(self._command(name, *args), kw)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 1350, in _command
    raise self.readonly('mailbox status changed to READ-ONLY')
imaplib2.IMAP4.readonly: mailbox status changed to READ-ONLY

Steps to reproduce the error

I just run offlineimap -c offlineimaprc. It did not happen until recently (maybe there was an upgrade to 8.0.0)?

rom1v avatar Apr 19 '23 20:04 rom1v

For people searching, I believe you shoud use non-default readonly = True per https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf#L1329

juju4 avatar Jan 19 '25 21:01 juju4