diff options
author | Karel Balej <balejk@matfyz.cz> | 2024-01-30 20:11:26 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-02-12 22:56:16 +0100 |
commit | 324e620c5a62fee07970c436f792c7383a3fb1e5 (patch) | |
tree | 7bf519252f9fc74c4490dd5e95a1310ebbf909b5 /commands | |
parent | 1bc295580e0b2caf9349226f46f4ea29c7b12a7a (diff) | |
download | aerc-324e620c5a62fee07970c436f792c7383a3fb1e5.tar.gz |
jmap: set explicit sender and recipients
JMAP is able to automatically determine sender and recipients based on
the message headers after it is submitted for sending. However this
means that it is not possible to send a message with the From header not
matching the account with this approach (or to send the message to
recipients not listed in the headers). Luckily, JMAP allows setting the
envelope containing the envelope sender and recipients manually. Modify
the code to do so.
Also bump go-jmap to include a fix needed for this to work.
Signed-off-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/compose/send.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go index 25df174d..65b501b4 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -182,7 +182,7 @@ func send(composer *app.Composer, header *mail.Header, uri *url.URL, domain stri case "smtp", "smtp+insecure", "smtps": sender, err = newSmtpSender(protocol, auth, uri, domain, from, rcpts) case "jmap": - sender, err = newJmapSender(composer, header) + sender, err = newJmapSender(composer.Worker(), from, rcpts) case "": sender, err = newSendmailSender(uri, rcpts) default: @@ -519,13 +519,13 @@ func connectSmtps(host string) (*smtp.Client, error) { } func newJmapSender( - composer *app.Composer, header *mail.Header, + worker *types.Worker, from *mail.Address, rcpts []*mail.Address, ) (io.WriteCloser, error) { var writer io.WriteCloser done := make(chan error) - composer.Worker().PostAction( - &types.StartSendingMessage{Header: header}, + worker.PostAction( + &types.StartSendingMessage{From: from, Rcpts: rcpts}, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Done: |