fix problem with undisclosed recipient showing up in To: v1 PROPOSED

y0ast: 1
 fix problem with undisclosed recipient showing up in To:

 1 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/12209/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] fix problem with undisclosed recipient showing up in To: Export this patch

Currently, at least in imap, when doing reply-all to a message sent from
gmail (others could be affected to) with no emails in To or CC (only
bcc) the header contains "undisclosed-recipients:;". This gets parsed by
go-imap as "<undisclosed-recipients@>, <@>" (so actually two
addresses!). If we do reply all, aerc actually adds these malformed
emails to the To: field.

This patch adds an extra filter to see if emails are parseable (I
believe From and ReplyTo cannot be malformed so the filter is not
applied there).

This proposed solution is quite ugly. I think the correct behaviour
could be for go-imap to parse "undisclosed-recipients:;" as a name, and
then for aerc to filter out all addresses without an addr.Address in the

 commands/msg/reply.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 3c8016e..2f79706 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -119,7 +119,10 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {

		envTos := make([]*models.Address, 0, len(msg.Envelope.To))
		for _, addr := range msg.Envelope.To {
			if recSet.Contains(addr) {
			// Make sure the address is an actual adress
			// this filters "undisclosed recipients"
			_, err := format.ParseAddress(addr.Address)
			if err != nil || recSet.Contains(addr) {
			envTos = append(envTos, addr)