Subject: notmuch new: emails with BOM are ignored
Date: Tuesday 27th May 2014 08:35:33 UTC (over 3 years ago)
Hi, I recently received some spam mails, which have a utf-16 byte order mark (BOM) U+FEFF as the first character in one of their "Received:" lines. When I run "notmuch new" I get the following: Note: Ignoring non-mail file: /home/user/Mail/new/path_to_email_with_BOM Could this be a bug in notmuch? Possible emails with BOM are not "legal" anyhow, but in my opinion it would be better to simply ignore the BOM. I am using notmuch 0.18. Andreas P.S.: looking quickly at the code as a non-expert, it seems that the error message comes from function "add_file" in "notmuch-new.c", because it gets a status of "NOTMUCH_STATUS_FILE_NOT_EMAIL" from "notmuch_database_add_message". This latter function is defined in "lib/database.cc". It returns that status in the case, when "notmuch_message_file_get_header" does not work (i.e. return NULL or "") for the headers "from", "subject" or "to". In the message at hand all of these headers only come after the BOM, so my guess is that "notmuch_message_file_get_header" somehow chokes when it hits on the BOM?