rtucker / imap2maildir

Backs up an IMAP mailbox to a maildir. Useful for backing up mail stored on free webmail providers, etc.
http://blog.hoopycat.com/index.php/2009/07/04/imap2maildir-a-tool-for-mirroring-imap-t
MIT License
99 stars 22 forks source link

Handling \\ in the subject line #11

Open nevetS opened 13 years ago

nevetS commented 13 years ago

First off THANK YOU for putting this together. I'm extraordinarily happy with the results.

I did want to fire off a quick note that emails with a subject line containing "\" are failing, presumably because it isn't handled during parsing.

I made a quick change to simpleimap.py in order to find the offending messages and simply changed their tag to get them out of the folder I was syncing.

On line 75: raise ValueError('Unexpected parenthesis at pos %(pos)d text %(text)s' % {'pos':pos, 'text': text})

The addition of the text variable shows enough information about the message to find it and move it or delete it for now. I only had two of these messages so I didn't get into the code deep enough to come up with a resolution to the problem.

rtucker commented 13 years ago

Good call! This is in commit 5a8b6b5acffe95f26928211a63f5bf1ae8739349.

Another user (in issue #10 I believe) suggested a change to quoted_re to improve a similar sort of thing. I couldn't reproduce the problem, but I have included the suggested quoted_re in commit f0634936ab81be1d87f1fc8063c5977c0efbaa65 ... that's probably worth a spin too.

Thanks! -rt