Date header fallback: Don't crash if there's no date header. Also log it.
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 4 Jul 2012 09:33:08 +0000 (11:33 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 4 Jul 2012 09:33:08 +0000 (11:33 +0200)
src/fix_imap_internaldate.py

index 99097bb..39b937a 100644 (file)
@@ -157,7 +157,11 @@ def synchronize_csv(config, test_mode):
                         if(config.getboolean('basic_settings', 'fallback_to_date_header')):
                             fetched_correct_date = session.fetch_basic_date(mid)
                             correct_date = date_parser.extract_received_date(fetched_correct_date)
-                        else:
+                            if(correct_date == ""):
+                                logging.debug("No fallback date header could be found in message uid: %s - mailbox: %s - user: %s.",
+                                                mid.decode('iso-8859-1'), box.name, box.owner)
+
+                        if(correct_date == ""):
                             # skip synchronization for this message
                             continue
                     else: