When file_use_mail_timestamp or utime_from_header are enabled,
OfflineIMAP tries to parse the Date header in the email. If the header
is present but invalid -- it doesn't contain a valid date -- this will
cause email.message to raise an exception. This is all fine. However
when handling that exception, OfflineIMAP can't try to extract the date
again: it's clearly invalid, and raising the same exception a second
time while handling the first exception just causes the entire sync to
fail.
To avoid that happening, don't try to provide the invalid date string in
the error message. Instead, just give the user the UID of the email
that triggered the exception, and the exception text.
Ideally we'd instead fix the code to actually extract the header value
and provide it in the error message, but Python's email.message module
doesn't provide an easy way to get the raw text of the Date header from
an EmailMessage object; it's possible using private variables like
EmailMessage._headers, or by parsing the email using a custom
email.policy.EmailPolicy object that disables the module's attempts to
coerce the header value to a DateTime. However, a user should be able
to get the problematic Date header from the message directly anyway, so
it's not worth adding all that complexity for something that should be
rare and provides little value.
Fixes#134
Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
>>> import offlineimap.imaputil
>>> b'&g0l6Pw-'.decode('imap4-utf-7')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/ldata/src/offlineimap3/offlineimap/imaputil.py", line 406, in utf7m_decode
for c in binary.decode():
AttributeError: 'memoryview' object has no attribute 'decode'
Signed-off-by: lilydjwg <lilydjwg@gmail.com>
This patch adds support to filter folders with the space caracter.
When the folder includes spaces, the folder name must be quoted.
This commit is basicaly a copy-paste of commit 81bd57e4
Signed-off-by: Hubert Pineault <hpineault@riseup.net>
This patch includes the "offlineimap" string and the proccess id
in the output for non interactive logs and syslog logs.
Now, the output is something like this (syslog):
Oct 11 21:55:10 yangon offlineimap[635798]: Syncing foo: IMAP -> Maildir
Oct 11 21:55:10 yangon offlineimap[635798]: Syncing foo bar: IMAP -> Maildir
Oct 11 21:55:10 yangon offlineimap[635798]: Syncing INBOX: IMAP -> Maildir
Oct 11 21:55:10 yangon offlineimap[635798]: Syncing bar: IMAP -> Maildir
Oct 11 21:55:10 yangon offlineimap[635798]: Syncing Trash: IMAP -> Maildir
Closes#88
This patch enables the ID extension of IMAPv4.
The patch sends the client name and the client version to the server.
Usually, the server doesn't require it, but in some cases the server
drop de connection if the ID is not send.
#Close #71
This patch sets the environment variable OFFLINEIMAPSYNCMODE to either
full, quick or idle depending on the context of the pre- and
postsynchook.
Adding the context as an argument was considered but this would break
existing configurations and it makes calling a program directly more
cumbersome. Some programs (e.g. imapfilter) may not know what to do with
this extra argument.
Signed-off-by: Mart Lubbers <mart@martlubbers.net>
Similarly to 7a428537, reading the host
using remotehosteval returns a bytes objects instead an utf-8 string.
This patch includes support for both string and bytes objects.
This patch handles the socks connection problems. First, move the "msg"
variable to the places where the variable is used. This variable could
be unset in the for loop, so is better move to these places.
This patch also removes the "msg" variable set in th except blocks, like
except socket.error as msg, because the variable is not used.
The patch also removes the "i" variable, not used.
Finally, the patch correct some typos.
Close: #67
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch adds support to create and delete folders with the space
character.
When the folder includes spaces, all the folder name must be quoted.
Close: #58
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch checks the exception raises by os.rename()
on Windows and provide the same behavior than Linux.
This patch is related to issue #37, issue 5.
This patch sets closes the issue 37.
closes#37
The new imaplib2 version >= 3.06 includes a function "version()",
and this patch uses the old style __version__ value and the new
function.
This patch is related to issue #37, issue 2.
- moved hyperlinks to the same section
- removed redundant and incorectly-formated Markdown hyperlink
- added the information of offlineimap 3 Arch Linux AUR package
- removed info of installing imaplib2 from its github repo: imaplib2 now
has a release on PyPI.
Moving the quoted boundary fix to the Base class so that it can be used
by any subclass that needs to read an email. Adding another utility to
extract message-id from a raw email.
Previously, the link to releases was pointing to offlineimap. I now point the link to the offlineimap3's releases.
I added a note explaining how one may install imaplib2 from git repository. This is related to issue #69.