pimalaya / himalaya

CLI to manage emails
https://pimalaya.org
MIT License
3.17k stars 95 forks source link

Error when date has different format #369

Closed rEnr3n closed 1 year ago

rEnr3n commented 2 years ago
$ himalaya --version
himalaya 0.5.10

I'm using the maildir backend and I got this error when I start the app.

$ himalaya
Error: cannot parse maildir envelopes from "/home/ren/.mail/purelymail"

Caused by:
    0: cannot parse maildir mail entry
    1: cannot parse maildir message date "05-FEB-2021 22:05:02"
    2: input contains invalid characters

I checked the email and it has the following three lines:

Received: from smtp-nlb02 ([10.141.249.58]) by M61SV059 with Microsoft SMTPSVC(10.0.17763.1);
     Fri, 5 Feb 2021 22:05:02 +0800
Date: 05-FEB-2021 22:05:02

I don't see this in other emails. The other emails have the following format: Date: Fri, 5 Feb 2021 22:05:02 +0800

soywod commented 2 years ago

Clearly the date does not follow the RFC. I cannot even see from which RFC this date format derives from :disappointed: not sure how to help. Any suggestion?

rEnr3n commented 2 years ago

I checked all the emails that have problematic values on Date:. They all have the correct format at the end of Received: just like OP. Others have these:

Received: from smtp-nlb02 ([10.141.249.58]) by M61SV059 with Microsoft SMTPSVC(10.0.17763.1)
    by mail.example.com
    ; Fri, 5 Feb 2021 22:05:02 +0800
Received: from smtp-nlb02 ([10.141.249.58]) by M61SV059 with Microsoft SMTPSVC(10.0.17763.1)
    by mail.example.com
    for <contact@example.com>; Fri,  5 Feb 2021 22:05:02 +0800

I don't completely understand the RFC but there's a mention here about folding. Is that what you're looking for?

soywod commented 2 years ago

I don't completely understand the RFC but there's a mention here about folding. Is that what you're looking for?

It could be the issue indeed. I will investigate. Could you share a complete raw email so I can reproduce and debug locally?

rEnr3n commented 2 years ago

I just sent you an email with the attached file.

soywod commented 1 year ago

Fixed by 6bd26f5, should be added to the next release #433.