From 94bff9130d4e0a3b93563792f141444b5083fe51 Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Tue, 13 Sep 2022 17:12:12 +0200 Subject: [PATCH] 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" Thanks: to Ricardo for checking and correcting my incorrect assertions Signed-off-by: Moritz Poldrack Acked-by: Tim Culverhouse --- CHANGELOG.md | 1 + config/config.go | 1 + doc/aerc-config.5.scd | 5 +++++ widgets/compose.go | 6 +++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 145a65d..7997db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/config/config.go b/config/config.go index e7e4de0..61ee3b3 100644 --- a/config/config.go +++ b/config/config.go @@ -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"` diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index ac28056..943c6c8 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -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 diff --git a/widgets/compose.go b/widgets/compose.go index 5106e17..db83a60 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -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 }