config: add option to hide timezone in sent emails

Some people are worried that they might leak their timezone and wish to
send their mails with the Date header in UTC. For this a new key is
added to the account sections to enforce sending in UTC instead of the
system's timezone.

Suggested-by: "Ricardo Correia" <aerc-lists.sr.ht@wizy.org>
Thanks: to Ricardo for checking and correcting my incorrect assertions
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
Moritz Poldrack 2022-09-13 17:12:12 +02:00 committed by Robin Jarry
parent 37c1db2ab2
commit 94bff9130d
4 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Support for bindings with the Alt modifier.
- Zoxide support with `:z`.
- Hide local timezone with `send-as-utc = true` in `accounts.conf`.
### Changed

View File

@ -163,6 +163,7 @@ type AccountConfig struct {
EnableFoldersSort bool `ini:"enable-folders-sort"`
FoldersSort []string `ini:"folders-sort" delim:","`
AddressBookCmd string `ini:"address-book-cmd"`
SendAsUTC bool `ini:"send-as-utc"`
// CheckMail
CheckMail time.Duration `ini:"check-mail"`

View File

@ -686,6 +686,11 @@ Note that many of these configuration options are written for you, such as
Default: Drafts
*send-as-utc*
Converts the timestamp of the Date header to UTC.
Default: false
*source*
Specifies the source for reading incoming emails on this account. This key
is required for all accounts. It should be a connection string, and the

View File

@ -584,7 +584,11 @@ func (c *Composer) PrepareHeader() (*mail.Header, error) {
}
}
if !c.header.Has("Date") {
c.header.SetDate(time.Now())
if c.acctConfig.SendAsUTC {
c.header.SetDate(time.Now().UTC())
} else {
c.header.SetDate(time.Now())
}
}
return c.header, nil
}