aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhrdl <git@hrdl.eu>2024-09-13 16:14:32 +0200
committerRobin Jarry <robin@jarry.cc>2024-10-12 00:35:20 +0200
commitd58065acd41ecce5ac5377a1341560dde87c5fe5 (patch)
treef6c336b03f012acbc88e460e8fd7b0f8164f6399
parent6ea2b786d4eb715e580f73e210a322aac10adc9f (diff)
downloadaerc-d58065acd41ecce5ac5377a1341560dde87c5fe5.tar.gz
send: allow using envelope from addressHEADdevel
Add a new boolean option in accounts.conf to use the envelope From address instead of the *from* configuration option when submitting via smtp, jmap or sendmail. Changelog-added: New `use-envelope-from` option in `accounts.conf`. Signed-off-by: hrdl <git@hrdl.eu> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--commands/compose/send.go5
-rw-r--r--config/accounts.go1
-rw-r--r--doc/aerc-accounts.5.scd6
3 files changed, 12 insertions, 0 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index 73672fed..aefeaa3c 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -110,6 +110,11 @@ func (s Send) Execute(args []string) error {
domain = domain_
}
from := config.From
+ if config.UseEnvelopeFrom {
+ if fl, _ := header.AddressList("from"); len(fl) != 0 {
+ from = fl[0]
+ }
+ }
log.Debugf("send config uri: %s", uri.Redacted())
log.Debugf("send config from: %s", from)
diff --git a/config/accounts.go b/config/accounts.go
index 35046f67..6748f8a4 100644
--- a/config/accounts.go
+++ b/config/accounts.go
@@ -102,6 +102,7 @@ type AccountConfig struct {
Default string `ini:"default" default:"INBOX"`
Postpone string `ini:"postpone" default:"Drafts"`
From *mail.Address `ini:"from"`
+ UseEnvelopeFrom bool `ini:"use-envelope-from" default:"false"`
Aliases []*mail.Address `ini:"aliases"`
Source string `ini:"source" parse:"ParseSource"`
Folders []string `ini:"folders" delim:","`
diff --git a/doc/aerc-accounts.5.scd b/doc/aerc-accounts.5.scd
index 399da629..b6aeb290 100644
--- a/doc/aerc-accounts.5.scd
+++ b/doc/aerc-accounts.5.scd
@@ -143,6 +143,12 @@ Note that many of these configuration options are written for you, such as
_hi@you.com_ and _contact@you.com_, respectively. The name from the alias,
not from the matching address, is used.
+*use-envelope-from* = _true_|_false_
+ Use the email envelope From header address instead of the *from*
+ configuration option when submitting messages.
+
+ Default: _false_
+
*headers* = _<header1,header2,header3...>_
Specifies the comma separated list of headers to fetch with the message.