marlam / msmtp

SMTP client with sendmail compatible interface
https://marlam.de/msmtp
GNU General Public License v3.0
176 stars 36 forks source link

`Date:` header added is wrong #141

Closed waldner closed 10 months ago

waldner commented 10 months ago

Just after midnight 1/1/2024, an msmtp instance started adding Date: headers like this:

Date: Mon, 01 Jan 2024 00:50:48 -9900

The system date of the machine where this is running is correct:

Mon Jan  1 12:53:05 AM CET 2024

set_date_header must be at the default of auto, since it's not configured.

UPDATE: As I wrote this, 1AM ticked and after 1AM, the added Date: header is back to normal:

Date: Mon, 01 Jan 2024 01:00:22 +0100

So take this as informational, perhaps there is some corner case that only appears during the hour from 00:00 to 1:00 on the 1/1.

marlam commented 10 months ago

Thanks for reporting this.

There was indeed a bug in the function that converts the time to RFC2822 format.

The bug existed in msmtp ever since it began writing Date headers. The code was imported from mpop, where it was introduced in version 0.7.0 in 2005. At that time, I was apparently stupid enough to think that meddling with time data manually instead of using strftime was in some way justifiable. I should have known better.

This is fixed now in both msmtp and mpop.

waldner commented 10 months ago

Thanks!