OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

Server responded: NO ['cannot create messages outside the Drafts mailbox'] #692

Open tompurl opened 3 years ago

tompurl commented 3 years ago

General informations

Configuration file offlineimaprc

# ~/.offlineimaprc

[general]
accounts = protonmail
pythonfile = ~/.config/offlineimap/keyring.py
metadata = ~/.cache/offlineimap

[Account protonmail]
remoterepository = protonmail-remote
localrepository = protonmail-local

[Repository protonmail-local]
type = Maildir
localfolders = ~/.mail
sync_deletes = yes

[Repository protonmail-remote]
# delete local mails that were deleted on the remote server
expunge = yes
type = IMAP
remotehost = 127.0.0.1
remoteport= 1143
remoteuser = somedude
remotepasseval = get_password("somedude@protonmail.com")

folderfilter = lambda foldername: foldername in ['INBOX', 'Archive', 'Sent']
ssl = no

pythonfile (if any)

#!/usr/bin/env python3

import re
import os

def get_password(login):
    machine = "127.0.0.1"
    port = "1143"
    s = "machine %s port %s login %s password ([^ ]*)\n" % (
        machine,
        port,
        login,
    )
    p = re.compile(s)
    authinfo = os.popen(
        "gpg -q --no-tty -d ~/.authinfo.gpg"
    ).read()
    return p.search(authinfo).group(1)

Logs, error

OfflineIMAP 7.3.3
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.101 (bundled), Python v2.7.18, OpenSSL 1.1.1i  8 Dec 2020
Account sync protonmail:
 *** Processing account protonmail
 Establishing connection to 127.0.0.1:1143 (protonmail-remote)
Folder INBOX [acc: protonmail]:
 Syncing INBOX: IMAP -> Maildir
Folder Archive [acc: protonmail]:
 Syncing Archive: IMAP -> Maildir
Folder Sent [acc: protonmail]:
 Syncing Sent: IMAP -> Maildir
Folder Archive [acc: protonmail]:
 Copy message UID -1 (1/1) protonmail-local:Archive -> protonmail-remote:Archive
Account sync protonmail:
 *** Finished account 'protonmail' in 0:13
Thread 'Folder Archive [acc: protonmail]' terminated with exception:
Traceback (most recent call last):
  File "/nix/store/jmijmxbnzrka7d1dqma6xgp8sv4kgqxl-offlineimap-7.3.3/lib/python2.7/site-packages/offlineimap/threadutil.py", line 160, in run
    Thread.run(self)
  File "/nix/store/kdhym3qz71sh03b0p7bkz7y2c50qsl04-python-2.7.18/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/nix/store/jmijmxbnzrka7d1dqma6xgp8sv4kgqxl-offlineimap-7.3.3/lib/python2.7/site-packages/offlineimap/accounts.py", line 668, in syncfolder
    localfolder.syncmessagesto(remotefolder, statusfolder)
  File "/nix/store/jmijmxbnzrka7d1dqma6xgp8sv4kgqxl-offlineimap-7.3.3/lib/python2.7/site-packages/offlineimap/folder/Base.py", line 1116, in syncmessagesto
    action(dstfolder, statusfolder)
  File "/nix/store/jmijmxbnzrka7d1dqma6xgp8sv4kgqxl-offlineimap-7.3.3/lib/python2.7/site-packages/offlineimap/folder/Base.py", line 944, in __syncmessagesto_copy
    self.copymessageto(uid, dstfolder, statusfolder, register=0)
  File "/nix/store/jmijmxbnzrka7d1dqma6xgp8sv4kgqxl-offlineimap-7.3.3/lib/python2.7/site-packages/offlineimap/folder/Base.py", line 844, in copymessageto
    new_uid = dstfolder.savemessage(uid, message, flags, rtime)
  File "/nix/store/jmijmxbnzrka7d1dqma6xgp8sv4kgqxl-offlineimap-7.3.3/lib/python2.7/site-packages/offlineimap/folder/IMAP.py", line 675, in savemessage
    raise OfflineImapError(msg, OfflineImapError.ERROR.REPO)
OfflineImapError: Saving msg (b6355b525a35115ac519a1abf59ae41d@posteo.de) in folder 'Archive', repository 'protonmail-remote' failed (abort). Server responded: NO ['cannot create messages outside the Drafts mailbox']

Last 15 debug messages logged for Folder Archive [acc: protonmail] prior to exception:
imap: __options2hash returning: {'INTERNALDATE': '"21-Mar-2021 08:30:41 -0500"', 'FLAGS': '(Coupons)', 'UID': '3279'}
imap: __options2hash returning: {'INTERNALDATE': '"21-Mar-2021 09:50:08 -0500"', 'FLAGS': '(Coupons)', 'UID': '3280'}
imap: Write mail 'Archive:-1' with flags set(['S'])
: deletemessageheaders: called to delete []
: getmessageheader: called to get message-id
: getmessageheader: eoh = 520
: getmessageheader: headers = 'Content-Type: multipart/mixed;\r\n boundary=8457ff4dbd4d28e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6\r\nMime-Version: 1.0\r\nMessage-Id: b6355b525a35115ac519a1abf59ae41d@posteo.de\r\nTo: <tom@tompurl.com>\r\nFrom: "Tom Purl" <tompurl@posteo.de>\r\nSubject: Test 5\r\nDate: Sat, 20 Mar 2021 11:00:08 -0500\r\n\r\n--8457ff4dbd4d28e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6\r\nContent-Transfer-Encoding: quoted-printable\r\nContent-Type: text/plain; charset=utf-8\r\n\r\n\r\n\r\n--8457ff4dbd4d28e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6--\r\n'
imap: savemessage: header is: X-OfflineIMAP: 3576354771-2792671148
: addmessageheader: called to add X-OfflineIMAP: 3576354771-2792671148
: addmessageheader: headers end at position 294
: addmessageheader: header/body transition "                 "context (marked by ==>EOH<==): 'l.com>\r\nFrom: "Tom Purl" <tompurl@posteo.de>\r\nSubject: Test 5\r\nDate: Sat, 20 Mar 2021 11:00:08 -0500'==>EOH<=='\r\n\r\n--8457ff4dbd4d28e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6\r\nContent-Transfer-Encoding: quote'
: addmessageheader: insertionpoint = 294
: addmessageheader: headers = 'Content-Type: multipart/mixed;\r\n boundary=8457ff4dbd4d28e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6\r\nMime-Version: 1.0\r\nMessage-Id: b6355b525a35115ac519a1abf59ae41d@posteo.de\r\nTo: <tom@tompurl.com>\r\nFrom: "Tom Purl" <tompurl@posteo.de>\r\nSubject: Test 5\r\nDate: Sat, 20 Mar 2021 11:00:08 -0500'
: addmessageheader: new_header = '\r\nX-OfflineIMAP: 3576354771-2792671148'
imap: savemessage: date: "20-Mar-2021 11:00:31 -0500", content: 'Content-Type: multipart/mixed;
 boundary=8457ff4dbd4d28e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6
Mime-Version: 1.0
Message-Id: b6355b525a35115...e33e7ea0fea3b1993bf048cf9db6ecef049b6b8387a3b6--
'

Steps to reproduce the error

  1. Receive a new message in my inbox
  2. Sync my local maildir with my Protonmail account successfully using offlineimap (which points at a hydroxide process)
  3. Run mu index
  4. Open mu4e and move my message from my INBOX folder to my Archive folder.
  5. Attempt to sync my mailbox again using offlineimap

Other Information

Here's what I've tried:

nicolas33 commented 3 years ago

You must folderfilter the 'Archive' folder. It's likely read-only.

stelgenhof commented 3 years ago

I'm getting the same message but when deleting a mail. My setup is similar to @tompurl except I use mbsync instead of offlineimap (and using Arch Linux).

Edit: after bit more digging in the Hydroxide repos... https://github.com/emersion/hydroxide/issues/91