OfflineIMAP / offlineimap

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

MemoryError when using Maildir with large emails (>10MB) #722

Open fcueto opened 2 years ago

fcueto commented 2 years ago

General informations

Configuration file offlineimaprc

[general]
accounts = Gmail
maxsyncaccounts = 1
ui = basic
socktimeout = 30

[Account Gmail]
localrepository = Local
remoterepository = Remote
autorefresh = 2
quick = 10

[Repository Local]
type = Maildir
localfolders = ~/Maildir
sep = .
nametrans = lambda foldername:  re.sub('.Drafts', '[Gmail].Drafts',
                                re.sub('.Sent', '[Gmail].Sent Mail',
                                re.sub('.Trash', '[Gmail].Trash', foldername)))

[Repository Remote]
type = IMAP
remotehost = imap.gmail.com
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
starttls = no
remoteuser = xxx
auth_mechanisms = XOAUTH2
oauth2_client_id = xxx.apps.googleusercontent.com
oauth2_client_secret = xxx
oauth2_request_url = https://accounts.google.com/o/oauth2/token
oauth2_refresh_token = xxx
maxconnections = 1
keepalive = 60

folderfilter = lambda foldername: foldername in ['INBOX', '[Gmail]/Sent Mail', '[Gmail]/Drafts', '[Gmail]/Trash']
nametrans = lambda foldername:  re.sub('.*Drafts$', '.Drafts',
                                re.sub('.*Sent Mail$', '.Sent',
                                re.sub('.*Trash$', '.Trash',
                                re.sub('^INBOX', '', foldername))))

pythonfile (if any)

N/A

Logs, error

2022-08-10 18:10:49 ERROR: ERROR: Copying message -1 [acc: Gmail]

2022-08-10 18:10:49 ERROR: ERROR: while syncing  [account Gmail]

2022-08-10 18:10:49 ERROR: ERROR: ERROR in syncfolder for Gmail folder : Traceback (most recent call last):
  File "/home/user/install/offlineimap-7.3.0/offlineimap/accounts.py", line 662, in syncfolder
    localfolder.syncmessagesto(remotefolder, statusfolder)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Base.py", line 1116, in syncmessagesto
    action(dstfolder, statusfolder)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Base.py", line 944, in __syncmessagesto_copy
    self.copymessageto(uid, dstfolder, statusfolder, register=0)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Base.py", line 839, in copymessageto
    message = self.getmessage(uid)
  File "/home/user/install/offlineimap-7.3.0/offlineimap/folder/Maildir.py", line 273, in getmessage
    retval = file.read()
MemoryError

Steps to reproduce the error

Trying to sync Maildir<->Gmail with an email >10MB