On Fri, Jun 28 2019, Alvaro Herrera wrote: > On 2019-Jun-28, Alvaro Herrera wrote: > >> I think a real solution is to parse the message header, look for the >> Content-Length, and determine mbox-ness by looking for "From" only past >> that many bytes; that seems to match what other mail parsing tools do. > > Sorry, I misspoke: there's no such thing as Content-Length. > It's Content-Type/boundary that needs to be watched for. Only consider > that the file is an mbox if a "^From " line appears after the boundary > end marker (which seems to be defined as "the boundary string followed > by two dashes --"). Just checking line starting with 'From ' would be pretty naïve since From may be first word in any line in text body. If we'd have to do content scanning then at least empty line before From would be reguired, and next lines starting like Received: someone@not.an.example Date: a date From: someone (and then empty line... ;) all this checkin would be required and still it could fail (perhaps this content get modified in the fly, but then signature check, if this mail had one, could fail...) If there is header that tells the length of the body, then things could be easier... Tomi > > -- > Álvaro Herrera Valdivia, Chile _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch