Sync back local emails modification
Mario D'Amore
kidpixo at gmail.com
Fri Oct 23 18:07:47 BST 2015
Hi,
I'm really happy that actually someone answer!
I just put the script on github, you are free to contribute :
https://github.com/kidpixo/pymimedetacher
It is a pretty naive approach, but it could :
- read a maildir directory
- cycle all the message, if there is a part the is neither text or
multipart >
- decode the attachment
- set the attachment to plain/text with a note on the file position
- save the attachment in FOLDER/MAIL_NAME/ATTACHMENTS
There are a lot of thing to improve, but the first is to sync the modified
mails to the server.
In principle I would like to leave each mail in the same state it was, I
don't want to find a bunch of random unread.
But thinking about it, it make sense because I create a new mail message...
Actually, this is the normal behaviour opening the mail with
src_mbox = mailbox.Maildir('maildir-mbox', factory=mailbox.MaildirMessage)
see [1].
I use to use "factory=None" exactly for this reason, see discussion here
[2]
Cheers,
Mario
[1]:
http://www.onlamp.com/pub/a/python/2007/06/28/processing-mailbox-files-with-mailboxpy.html
[2]:
http://stackoverflow.com/questions/13444175/how-can-i-get-pythons-maildir-to-read-the-updated-state/13445253#13445253
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20151023/fd0b4584/attachment-0003.html>
More information about the OfflineIMAP-project
mailing list