mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-03-06 18:23:44 +01:00
reply: handle the Sender header
Sometimes emails will have a Sender: header, that is different from the From: header. The only use of this in the wild I have seen to date is when meeting invitation is forwarded by somebody. The From: header will be the person organising the meeting, and the Sender: will be the person forwarding. Naturally, when one replies (e.g. with on accept), it should go to the meeting oragniser, but sometimes one would want to include the Sender in such a reply. When executing :reply determine the To: address in order of Reply-To:, From:, Sender:. When executing :reply -a, include the Sender: in Cc:. Implements: https://todo.sr.ht/~rjarry/aerc/259 Link: https://www.rfc-editor.org/rfc/rfc4021#section-2.1.3 Changelog-added: Replying to all will include the Sender in Cc. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Reviewed-by: Tim Culverhouse <tim@timculverhouse.com> Reviewed-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
committed by
Robin Jarry
parent
1d4eafb011
commit
88d5de97d6
@@ -86,11 +86,13 @@ func (r reply) Execute(args []string) error {
|
||||
)
|
||||
|
||||
recSet := newAddrSet() // used for de-duping
|
||||
|
||||
if len(msg.Envelope.ReplyTo) != 0 {
|
||||
switch {
|
||||
case len(msg.Envelope.ReplyTo) != 0:
|
||||
to = msg.Envelope.ReplyTo
|
||||
} else {
|
||||
case len(msg.Envelope.From) != 0:
|
||||
to = msg.Envelope.From
|
||||
default:
|
||||
to = msg.Envelope.Sender
|
||||
}
|
||||
|
||||
if !config.Compose.ReplyToSelf {
|
||||
@@ -131,6 +133,13 @@ func (r reply) Execute(args []string) error {
|
||||
}
|
||||
cc = append(cc, addr)
|
||||
}
|
||||
for _, addr := range msg.Envelope.Sender {
|
||||
// dedupe stuff from the to/from headers
|
||||
if recSet.Contains(addr) {
|
||||
continue
|
||||
}
|
||||
cc = append(cc, addr)
|
||||
}
|
||||
recSet.AddList(cc)
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ func parseEnvelope(h *mail.Header) *models.Envelope {
|
||||
MessageId: msgID,
|
||||
From: parseAddressList(h, "from"),
|
||||
ReplyTo: parseAddressList(h, "reply-to"),
|
||||
Sender: parseAddressList(h, "sender"),
|
||||
To: parseAddressList(h, "to"),
|
||||
Cc: parseAddressList(h, "cc"),
|
||||
Bcc: parseAddressList(h, "bcc"),
|
||||
|
||||
@@ -229,6 +229,7 @@ type Envelope struct {
|
||||
Subject string
|
||||
From []*mail.Address
|
||||
ReplyTo []*mail.Address
|
||||
Sender []*mail.Address
|
||||
To []*mail.Address
|
||||
Cc []*mail.Address
|
||||
Bcc []*mail.Address
|
||||
|
||||
Reference in New Issue
Block a user