aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2006-09-28 23:31:47 +0000
committerNikolaus Schulz <microschulz@web.de>2006-09-28 23:31:47 +0000
commit140596178c5dea3ef6d42b2edf76c9c785bcb702 (patch)
tree1494b98f1bd42106559a6d516ab7b5ec5892141a
parent8d5b36dc3a4709df25a655831f7b346e6c48ca32 (diff)
downloadarchivemail-140596178c5dea3ef6d42b2edf76c9c785bcb702.tar.gz
archivemail-140596178c5dea3ef6d42b2edf76c9c785bcb702.tar.bz2
archivemail-140596178c5dea3ef6d42b2edf76c9c785bcb702.zip
Convert on-the-wire CRLF to native EOL when saving messages from an IMAP folder.
-rwxr-xr-xarchivemail.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/archivemail.py b/archivemail.py
index 81ab69a..9a36004 100755
--- a/archivemail.py
+++ b/archivemail.py
@@ -1270,7 +1270,10 @@ def _archive_imap(mailbox_name, final_archive_name):
for msg_id in message_list:
result, response = imap_srv.fetch(msg_id, '(RFC822 FLAGS)')
if result != 'OK': unexpected_error("Failed to fetch message")
- msg_str = response[0][1]
+ if "\r\n" == os.linesep:
+ msg_str = response[0][1]
+ else:
+ msg_str = response[0][1].replace("\r\n", os.linesep)
msg_flags = imaplib.ParseFlags(response[1])
msg = rfc822.Message(cStringIO.StringIO(msg_str))
add_status_headers_imap(msg, msg_flags)