Github messages for mblaze
 help / color / mirror / Atom feed
* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
@ 2020-03-30 11:22 ` nmeum
  2020-03-30 11:59 ` leahneukirchen
                   ` (36 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 11:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605941675

Comment:
Good point, RFC 5322 addresses complicate this setup quite a bit. For example, my assumption was that `Alternate-Mailboxes` just contains the mail address but that's not necessarily the case, right? If so, it would probably make sense to modify `grepmine` in a way that it operates only on the mail address part and later map that address to the display name using a different function? Is there already any tool for extracting the display-name/mail-address part of an [RFC 5322 address](https://tools.ietf.org/html/rfc5322#section-3.4)?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
  2020-03-30 11:22 ` mrep: Set From header according to To/Cc header nmeum
@ 2020-03-30 11:59 ` leahneukirchen
  2020-03-30 12:05 ` Duncaen
                   ` (35 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-03-30 11:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605956990

Comment:
I think alternate-mailboxes should just contain the addresses.

maddr -a can print the address only, i guess adding maddr -d would be useful.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
  2020-03-30 11:22 ` mrep: Set From header according to To/Cc header nmeum
  2020-03-30 11:59 ` leahneukirchen
@ 2020-03-30 12:05 ` Duncaen
  2020-03-30 12:08 ` Duncaen
                   ` (34 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: Duncaen @ 2020-03-30 12:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

New comment by Duncaen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605959471

Comment:
`magrep` with `-a`  would be a good instead of grep, but it only matches all headers or one header at a time.

```
magrep -qa "to:mail@duncano.de|administrator@duncano.de" 1000
```

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (2 preceding siblings ...)
  2020-03-30 12:05 ` Duncaen
@ 2020-03-30 12:08 ` Duncaen
  2020-03-30 12:09 ` Duncaen
                   ` (33 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: Duncaen @ 2020-03-30 12:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

New comment by Duncaen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605959471

Comment:
`magrep` with `-a`  would be a good instead of grep, but it only matches all headers or one header at a time.

```
$ magrep -ha "to:mail@duncano.de|administrator@duncano.de" 100
to: administrator@duncano.de
```

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (3 preceding siblings ...)
  2020-03-30 12:08 ` Duncaen
@ 2020-03-30 12:09 ` Duncaen
  2020-03-30 12:16 ` Duncaen
                   ` (32 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: Duncaen @ 2020-03-30 12:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

New comment by Duncaen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605959471

Comment:
`magrep` with `-a`  would be a good instead of grep, but it only matches all headers or one header at a time.

```
$ magrep -ha "to:mail@duncano.de|administrator@duncano.de" 100
to: administrator@duncano.de
$ mhdr -h to 100
Duncan Overbruck <administrator@duncano.de>
```

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (4 preceding siblings ...)
  2020-03-30 12:09 ` Duncaen
@ 2020-03-30 12:16 ` Duncaen
  2020-03-30 12:54 ` nmeum
                   ` (31 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: Duncaen @ 2020-03-30 12:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

New comment by Duncaen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605959471

Comment:
`magrep` with `-a`  would be a good instead of grep, but it only matches all headers or one header at a time.

```
$ magrep -ha "to:mail@duncano.de|administrator@duncano.de" 100
to: administrator@duncano.de
$ mhdr -h to 100
Duncan Overbruck <administrator@duncano.de>
```

Edit: nvm, this doesn't really solve the problem, but might be better than a plain grep if someone messes with comments in addresses etc.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (5 preceding siblings ...)
  2020-03-30 12:16 ` Duncaen
@ 2020-03-30 12:54 ` nmeum
  2020-03-30 13:04 ` leahneukirchen
                   ` (30 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 12:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 430 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605981282

Comment:
> I think alternate-mailboxes should just contain the addresses.

Good to know, but the `Local-Mailbox` should definitely contain a valid RFC 5322 address, or at least mine does. In general, it might makes sense to use this as is and improve it later on when tooling around RFC 5322 has improved? idk.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (6 preceding siblings ...)
  2020-03-30 12:54 ` nmeum
@ 2020-03-30 13:04 ` leahneukirchen
  2020-03-30 14:49 ` nmeum
                   ` (29 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-03-30 13:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605986244

Comment:
Perhaps we can use a different header in the configuration for this feature.  Then map that by address to the given displayname.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (7 preceding siblings ...)
  2020-03-30 13:04 ` leahneukirchen
@ 2020-03-30 14:49 ` nmeum
  2020-03-30 14:56 ` leahneukirchen
                   ` (28 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 14:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606046386

Comment:
Just to make sure I understood you correctly: You are proposing adding an additional header to `mblaze-profile(5)` which contains a display name which is then combined with the address extracted from the To/Cc header and used as the From header in the reply?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (8 preceding siblings ...)
  2020-03-30 14:49 ` nmeum
@ 2020-03-30 14:56 ` leahneukirchen
  2020-03-30 17:37 ` [PR PATCH] [Updated] " nmeum
                   ` (27 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-03-30 14:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606050252

Comment:
Exactly.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (9 preceding siblings ...)
  2020-03-30 14:56 ` leahneukirchen
@ 2020-03-30 17:37 ` nmeum
  2020-03-30 17:37 ` nmeum
                   ` (26 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 2839 bytes --]

From 76b882d0eb10f4e77cc3462ab158fc6243dee56d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 11:31:18 +0200
Subject: [PATCH 1/2] mrep: Set From header according to To/Cc header

I use different mail addresses for different purposes. When replying to
any email, mrep(1) currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address the email
was sent to (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`.
---
 mcom | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mcom b/mcom
index e2f7100..9bfeecc 100755
--- a/mcom
+++ b/mcom
@@ -10,9 +10,9 @@ commajoin() {
 	     END {print l}'
 }
 
-notmine() {
+grepmine() {
 	mine="$(maddr -a -h local-mailbox:alternate-mailboxes: "$MBLAZE/profile")"
-	grep -Fv -e "$mine"
+	grep -F -e "$mine" "$@"
 }
 
 ouniq() {
@@ -349,14 +349,15 @@ fi
 			printf 'To: %s\n' "$to"
 			printf 'Cc: %s\n' \
 			       "$(mhdr -d -A -h to:cc: "$1" |
-				       notmine |grep -Fv -e "$to" |
+				       grepmine -v |grep -Fv -e "$to" |
 				       ouniq |commajoin)"
 			printf 'Bcc: \n'
 			printf '%s\n' "$hdrs" | awk '{ print }' |
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		from=$(mhdr -d -A -h to:cc: "$1" | grepmine | head -n 1)
+		[ -z "$from" ] && from=$(mhdr -h local-mailbox "$MBLAZE/profile")
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

From 41671c0deeea5d0eed1efb24703efc3555ac7424 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 19:36:31 +0200
Subject: [PATCH 2/2] fixup! mrep: Set From header according to To/Cc header

---
 mcom | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mcom b/mcom
index 9bfeecc..70c46f8 100755
--- a/mcom
+++ b/mcom
@@ -356,8 +356,12 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -d -A -h to:cc: "$1" | grepmine | head -n 1)
-		[ -z "$from" ] && from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		addr=$(maddr -a -h to:ccc:bcc: "$1" | grepmine | head -n 1)
+		[ -n "$addr" ] && from=$(printf "%s <%s>" \
+			"$(maddr -d -h "local-mailbox" "$MBLAZE/profile")" "$addr")
+		
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (10 preceding siblings ...)
  2020-03-30 17:37 ` [PR PATCH] [Updated] " nmeum
@ 2020-03-30 17:37 ` nmeum
  2020-03-30 17:46 ` [PR PATCH] [Updated] " nmeum
                   ` (25 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 806 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606140041

Comment:
> I added `maddr -d`.

Pushed a change which utilities `maddr -d` to extract the description part form the `local-mailbox` and combines that with the address extracted from the To/Cc/Bcc header. I haven't handled the case where the `local-mailbox` configuration header doesn't contain a description. However, this should address your [original comment](https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-605918055). I personally find that preferable to adding a new configuration header, let me know what you think.

> not sure we need that actually, but it's an obvious feature.

I personally find it very handy, but if you don't want it that's fine as well.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (11 preceding siblings ...)
  2020-03-30 17:37 ` nmeum
@ 2020-03-30 17:46 ` nmeum
  2020-03-30 17:48 ` nmeum
                   ` (24 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 3621 bytes --]

From 76b882d0eb10f4e77cc3462ab158fc6243dee56d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 11:31:18 +0200
Subject: [PATCH 1/3] mrep: Set From header according to To/Cc header

I use different mail addresses for different purposes. When replying to
any email, mrep(1) currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address the email
was sent to (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`.
---
 mcom | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mcom b/mcom
index e2f7100..9bfeecc 100755
--- a/mcom
+++ b/mcom
@@ -10,9 +10,9 @@ commajoin() {
 	     END {print l}'
 }
 
-notmine() {
+grepmine() {
 	mine="$(maddr -a -h local-mailbox:alternate-mailboxes: "$MBLAZE/profile")"
-	grep -Fv -e "$mine"
+	grep -F -e "$mine" "$@"
 }
 
 ouniq() {
@@ -349,14 +349,15 @@ fi
 			printf 'To: %s\n' "$to"
 			printf 'Cc: %s\n' \
 			       "$(mhdr -d -A -h to:cc: "$1" |
-				       notmine |grep -Fv -e "$to" |
+				       grepmine -v |grep -Fv -e "$to" |
 				       ouniq |commajoin)"
 			printf 'Bcc: \n'
 			printf '%s\n' "$hdrs" | awk '{ print }' |
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		from=$(mhdr -d -A -h to:cc: "$1" | grepmine | head -n 1)
+		[ -z "$from" ] && from=$(mhdr -h local-mailbox "$MBLAZE/profile")
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

From 41671c0deeea5d0eed1efb24703efc3555ac7424 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 19:36:31 +0200
Subject: [PATCH 2/3] fixup! mrep: Set From header according to To/Cc header

---
 mcom | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mcom b/mcom
index 9bfeecc..70c46f8 100755
--- a/mcom
+++ b/mcom
@@ -356,8 +356,12 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -d -A -h to:cc: "$1" | grepmine | head -n 1)
-		[ -z "$from" ] && from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		addr=$(maddr -a -h to:ccc:bcc: "$1" | grepmine | head -n 1)
+		[ -n "$addr" ] && from=$(printf "%s <%s>" \
+			"$(maddr -d -h "local-mailbox" "$MBLAZE/profile")" "$addr")
+		
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

From fe193fb4e1e8bd4beb174497710ffd347f5c1945 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 19:46:11 +0200
Subject: [PATCH 3/3] fixup! mrep: Set From header according to To/Cc header

---
 mcom | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mcom b/mcom
index 70c46f8..c0f80d0 100755
--- a/mcom
+++ b/mcom
@@ -358,7 +358,7 @@ fi
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
 
 		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
-		addr=$(maddr -a -h to:ccc:bcc: "$1" | grepmine | head -n 1)
+		addr=$(maddr -a -h to:cc:bcc: "$1" | grepmine | head -n 1)
 		[ -n "$addr" ] && from=$(printf "%s <%s>" \
 			"$(maddr -d -h "local-mailbox" "$MBLAZE/profile")" "$addr")
 		

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (12 preceding siblings ...)
  2020-03-30 17:46 ` [PR PATCH] [Updated] " nmeum
@ 2020-03-30 17:48 ` nmeum
  2020-03-30 17:50 ` leahneukirchen
                   ` (23 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606145682

Comment:
The more compilated version which also handles a missing description in `local-mailbox` would be:

```shell
addr=$(maddr -a -h to:cc:bcc: "$1" | grepmine | head -n 1)
if [ -n "$addr" ]; then
	desc=$(maddr -d -h "local-mailbox" "$MBLAZE/profile")
	if [ -n "$desc" ]; then
		from=$(printf "%s <%s>" "$desc" "$addr")
	else
		from=$addr
	fi
else
	from=$(mhdr -h local-mailbox "$MBLAZE/profile")
fi
```

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (13 preceding siblings ...)
  2020-03-30 17:48 ` nmeum
@ 2020-03-30 17:50 ` leahneukirchen
  2020-03-30 17:56 ` nmeum
                   ` (22 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-03-30 17:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606146950

Comment:
Well, I have some private addresses that are listed as Alternative-Mailboxes to get the `>` sign, but that I don't use for replying. Also, people could use From: addresses that are not in Alternative-Mailboxes (e.g. a shared helpdesk email).

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (14 preceding siblings ...)
  2020-03-30 17:50 ` leahneukirchen
@ 2020-03-30 17:56 ` nmeum
  2020-03-30 17:56 ` nmeum
                   ` (21 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606149621

Comment:
> Well, I have some private addresses that are listed as Alternative-Mailboxes to get the sign, but that I don't use for replying.

It would certainly be possible to add a new `auto-reply-addresses` or something a long the lines profile header setting.

> Also, people could use From: addresses that are not in Alternative-Mailboxes (e.g. a shared helpdesk email).

Why would that be a problem? Unless I am missing something here the code should fallback to `local-mailbox` then.

If you generally disagree with the feature I will just apply my patch locally. If you like the idea in general but don't like the implementation I can try to adjust it. Either way is fine with me.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (15 preceding siblings ...)
  2020-03-30 17:56 ` nmeum
@ 2020-03-30 17:56 ` nmeum
  2020-03-30 17:56 ` nmeum
                   ` (20 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606149621

Comment:
> Well, I have some private addresses that are listed as Alternative-Mailboxes to get the sign, but that I don't use for replying.

It would certainly be possible to add a new `auto-reply-addresses profile header setting.

> Also, people could use From: addresses that are not in Alternative-Mailboxes (e.g. a shared helpdesk email).

Why would that be a problem? Unless I am missing something here the code should fallback to `local-mailbox` then.

If you generally disagree with the feature I will just apply my patch locally. If you like the idea in general but don't like the implementation I can try to adjust it. Either way is fine with me.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (16 preceding siblings ...)
  2020-03-30 17:56 ` nmeum
@ 2020-03-30 17:56 ` nmeum
  2020-03-30 17:57 ` nmeum
                   ` (19 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606149621

Comment:
> Well, I have some private addresses that are listed as Alternative-Mailboxes to get the sign, but that I don't use for replying.

It would certainly be possible to add a new `auto-reply-addresses` profile header setting.

> Also, people could use From: addresses that are not in Alternative-Mailboxes (e.g. a shared helpdesk email).

Why would that be a problem? Unless I am missing something here the code should fallback to `local-mailbox` then.

If you generally disagree with the feature I will just apply my patch locally. If you like the idea in general but don't like the implementation I can try to adjust it. Either way is fine with me.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (17 preceding siblings ...)
  2020-03-30 17:56 ` nmeum
@ 2020-03-30 17:57 ` nmeum
  2020-03-30 18:02 ` leahneukirchen
                   ` (18 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 17:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606149621

Comment:
> Well, I have some private addresses that are listed as Alternative-Mailboxes to get the sign, but that I don't use for replying.

It would certainly be possible to add a new `auto-reply-addresses` profile header setting (or something along the lines).

> Also, people could use From: addresses that are not in Alternative-Mailboxes (e.g. a shared helpdesk email).

Why would that be a problem? Unless I am missing something here the code should fallback to `local-mailbox` then.

If you generally disagree with the feature I will just apply my patch locally. If you like the idea in general but don't like the implementation I can try to adjust it. Either way is fine with me.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (18 preceding siblings ...)
  2020-03-30 17:57 ` nmeum
@ 2020-03-30 18:02 ` leahneukirchen
  2020-03-30 18:04 ` leahneukirchen
                   ` (17 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-03-30 18:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606152541

Comment:
I'm thinking of a slightly more general feature, something like

```
replyfrom() {
        addrs="$(maddr -a -h reply-from "$MBLAZE/profile")"
        grep -Fv -e "addrs"
}
addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n 1)
if [ -n "$addr" ]; then
	from=$(maddr -h reply-from "$MBLAZE/profile" | grep -xi -e "<$addr>" | head - n1)
fi
if [ -z "$from" ]; then
	from=$(mhdr -h local-mailbox "$MBLAZE/profile")
fi
```

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (19 preceding siblings ...)
  2020-03-30 18:02 ` leahneukirchen
@ 2020-03-30 18:04 ` leahneukirchen
  2020-03-30 18:44 ` nmeum
                   ` (16 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-03-30 18:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606153663

Comment:
We could default addrs to alternative-mailboxes if reply-from is empty (having full names there should also be ok).

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (20 preceding siblings ...)
  2020-03-30 18:04 ` leahneukirchen
@ 2020-03-30 18:44 ` nmeum
  2020-04-20 13:43 ` [PR PATCH] [Updated] " nmeum
                   ` (15 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-03-30 18:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-606174195

Comment:
> I'm thinking of a slightly more general feature, […]

Sure, that would work for me :+1:

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (21 preceding siblings ...)
  2020-03-30 18:44 ` nmeum
@ 2020-04-20 13:43 ` nmeum
  2020-04-20 13:44 ` nmeum
                   ` (14 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 13:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 5895 bytes --]

From 32e65c842962f038b4a59d0b76928001ff9a187d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 11:31:18 +0200
Subject: [PATCH 1/4] mrep: Set From header according to To/Cc header

I use different mail addresses for different purposes. When replying to
any email, mrep(1) currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address the email
was sent to (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`.
---
 mcom | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mcom b/mcom
index e2f7100..9bfeecc 100755
--- a/mcom
+++ b/mcom
@@ -10,9 +10,9 @@ commajoin() {
 	     END {print l}'
 }
 
-notmine() {
+grepmine() {
 	mine="$(maddr -a -h local-mailbox:alternate-mailboxes: "$MBLAZE/profile")"
-	grep -Fv -e "$mine"
+	grep -F -e "$mine" "$@"
 }
 
 ouniq() {
@@ -349,14 +349,15 @@ fi
 			printf 'To: %s\n' "$to"
 			printf 'Cc: %s\n' \
 			       "$(mhdr -d -A -h to:cc: "$1" |
-				       notmine |grep -Fv -e "$to" |
+				       grepmine -v |grep -Fv -e "$to" |
 				       ouniq |commajoin)"
 			printf 'Bcc: \n'
 			printf '%s\n' "$hdrs" | awk '{ print }' |
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		from=$(mhdr -d -A -h to:cc: "$1" | grepmine | head -n 1)
+		[ -z "$from" ] && from=$(mhdr -h local-mailbox "$MBLAZE/profile")
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

From 6c54a1e08917a24ce92f8ee72dd92377317f9cec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 19:36:31 +0200
Subject: [PATCH 2/4] fixup! mrep: Set From header according to To/Cc header

---
 mcom | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mcom b/mcom
index 9bfeecc..70c46f8 100755
--- a/mcom
+++ b/mcom
@@ -356,8 +356,12 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -d -A -h to:cc: "$1" | grepmine | head -n 1)
-		[ -z "$from" ] && from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		addr=$(maddr -a -h to:ccc:bcc: "$1" | grepmine | head -n 1)
+		[ -n "$addr" ] && from=$(printf "%s <%s>" \
+			"$(maddr -d -h "local-mailbox" "$MBLAZE/profile")" "$addr")
+		
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

From ec156e0fc4795e702fa7544915bc2d7e2b1514e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 30 Mar 2020 19:46:11 +0200
Subject: [PATCH 3/4] fixup! mrep: Set From header according to To/Cc header

---
 mcom | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mcom b/mcom
index 70c46f8..c0f80d0 100755
--- a/mcom
+++ b/mcom
@@ -358,7 +358,7 @@ fi
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
 
 		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
-		addr=$(maddr -a -h to:ccc:bcc: "$1" | grepmine | head -n 1)
+		addr=$(maddr -a -h to:cc:bcc: "$1" | grepmine | head -n 1)
 		[ -n "$addr" ] && from=$(printf "%s <%s>" \
 			"$(maddr -d -h "local-mailbox" "$MBLAZE/profile")" "$addr")
 		

From 30dd0131141e8f72d5aebfd4c2840920d8f7ca75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 20 Apr 2020 15:20:27 +0200
Subject: [PATCH 4/4] mrep: Set From header according to To/Cc/Bcc header

If any of the address contained in the aforementioned headers matches an
address configured in the Reply-From header in mblaze-profile(5).

Without this change, mrep(1) uses the mail address configured as
Local-Mailbox for the From header. While generally desirable, I use
different mail addresses for different proposes. As such, I do not
want to reply to mails I received through my work address with my
private email address.
---
 man/mblaze-profile.5 |  3 +++
 mcom                 | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index e1fa01c..11fad7b 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -44,6 +44,9 @@ to recognize messages sent to you.
 A comma-separated list of mail addresses that also belong to you, for
 .Xr mscan 1
 to recognize messages sent by or directly to you.
+.It Li Reply-From\&:
+A comma-separated list of mail addresses that are automatically used for
+the From header in a reply if present in the Cc, To, or Bcc header.
 .It Li FQDN\&:
 The fully qualified domain name used for
 .Li Message\&-Id\&:
diff --git a/mcom b/mcom
index c0f80d0..674def5 100755
--- a/mcom
+++ b/mcom
@@ -15,6 +15,11 @@ grepmine() {
 	grep -F -e "$mine" "$@"
 }
 
+replyfrom() {
+	addrs="$(maddr -a -h reply-from "$MBLAZE/profile")"
+	grep -Fv -e "addrs"
+}
+
 ouniq() {
 	awk '!seen[$0]++'
 }
@@ -357,7 +362,15 @@ fi
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
 
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n1)
+		if [ -n "$addr" ]; then
+			from=$(maddr -h reply-from "$MBLAZE/profile" | \
+				awk "/$addr/ { print; exit }" | head -n1)
+		fi
+		if [ -z "$from" ]; then
+			from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		fi
+
 		addr=$(maddr -a -h to:cc:bcc: "$1" | grepmine | head -n 1)
 		[ -n "$addr" ] && from=$(printf "%s <%s>" \
 			"$(maddr -d -h "local-mailbox" "$MBLAZE/profile")" "$addr")

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (22 preceding siblings ...)
  2020-04-20 13:43 ` [PR PATCH] [Updated] " nmeum
@ 2020-04-20 13:44 ` nmeum
  2020-04-20 13:50 ` nmeum
                   ` (13 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 13:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 2226 bytes --]

From da529d813053eec38dc5d60cc278302ecad7e127 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 20 Apr 2020 15:20:27 +0200
Subject: [PATCH] mrep: Set From header according to To/Cc/Bcc header

If any of the address contained in the aforementioned headers matches an
address configured in the Reply-From header in mblaze-profile(5).

Without this change, mrep(1) uses the mail address configured as
Local-Mailbox for the From header. While generally desirable, I use
different mail addresses for different proposes. As such, I do not
want to reply to mails I received through my work address with my
private email address.
---
 man/mblaze-profile.5 |  3 +++
 mcom                 | 16 +++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index e1fa01c..11fad7b 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -44,6 +44,9 @@ to recognize messages sent to you.
 A comma-separated list of mail addresses that also belong to you, for
 .Xr mscan 1
 to recognize messages sent by or directly to you.
+.It Li Reply-From\&:
+A comma-separated list of mail addresses that are automatically used for
+the From header in a reply if present in the Cc, To, or Bcc header.
 .It Li FQDN\&:
 The fully qualified domain name used for
 .Li Message\&-Id\&:
diff --git a/mcom b/mcom
index e2f7100..804824f 100755
--- a/mcom
+++ b/mcom
@@ -15,6 +15,11 @@ notmine() {
 	grep -Fv -e "$mine"
 }
 
+replyfrom() {
+	addrs="$(maddr -a -h reply-from "$MBLAZE/profile")"
+	grep -Fv -e "addrs"
+}
+
 ouniq() {
 	awk '!seen[$0]++'
 }
@@ -356,7 +361,16 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n1)
+		if [ -n "$addr" ]; then
+			from=$(maddr -h reply-from "$MBLAZE/profile" | \
+				awk "/$addr/ { print; exit }" | head -n1)
+		fi
+		if [ -z "$from" ]; then
+			from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		fi
+
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (23 preceding siblings ...)
  2020-04-20 13:44 ` nmeum
@ 2020-04-20 13:50 ` nmeum
  2020-04-20 13:51 ` nmeum
                   ` (12 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 13:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 2207 bytes --]

From 878980b28ffe04ca2d000f6c44a909d1ae1a611e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 20 Apr 2020 15:20:27 +0200
Subject: [PATCH] mrep: Set From header according to To/Cc/Bcc header

If any of the address contained in the aforementioned headers matches an
address configured in the Reply-From header in mblaze-profile(5).

Without this change, mrep(1) uses the mail address configured as
Local-Mailbox for the From header. While generally desirable, I use
different mail addresses for different proposes. As such, I do not
want to reply to mails I received through my work address with my
private email address.
---
 man/mblaze-profile.5 |  3 +++
 mcom                 | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index e1fa01c..11fad7b 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -44,6 +44,9 @@ to recognize messages sent to you.
 A comma-separated list of mail addresses that also belong to you, for
 .Xr mscan 1
 to recognize messages sent by or directly to you.
+.It Li Reply-From\&:
+A comma-separated list of mail addresses that are automatically used for
+the From header in a reply if present in the Cc, To, or Bcc header.
 .It Li FQDN\&:
 The fully qualified domain name used for
 .Li Message\&-Id\&:
diff --git a/mcom b/mcom
index e2f7100..e2afc52 100755
--- a/mcom
+++ b/mcom
@@ -15,6 +15,11 @@ notmine() {
 	grep -Fv -e "$mine"
 }
 
+replyfrom() {
+	addrs="$(maddr -a -h reply-from "$MBLAZE/profile")"
+	grep -Fv -e "addrs"
+}
+
 ouniq() {
 	awk '!seen[$0]++'
 }
@@ -356,7 +361,15 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n1)
+		if [ -n "$addr" ]; then
+			from=$(maddr -h reply-from "$MBLAZE/profile" | grep -Fi "<$addr>" | head -n1)
+		fi
+		if [ -z "$from" ]; then
+			from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		fi
+
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (24 preceding siblings ...)
  2020-04-20 13:50 ` nmeum
@ 2020-04-20 13:51 ` nmeum
  2020-04-20 13:55 ` nmeum
                   ` (11 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 13:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-616567773

Comment:
Implemented (i.e. copied) your implementation. Also added some documentation to `mblaze-profile(5)`. The downside of this implementation is that you end of with a lot of duplicate address in `mblaze-profile(5)` at least for my simple use-case.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (25 preceding siblings ...)
  2020-04-20 13:51 ` nmeum
@ 2020-04-20 13:55 ` nmeum
  2020-04-20 13:55 ` nmeum
                   ` (10 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 13:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-616567773

Comment:
Implemented (i.e. copied) your suggestion. Also added some documentation to `mblaze-profile(5)`. The downside of this implementation is that you end of with a lot of duplicate address in `mblaze-profile(5)` at least for my simple use-case.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (26 preceding siblings ...)
  2020-04-20 13:55 ` nmeum
@ 2020-04-20 13:55 ` nmeum
  2020-04-20 13:58 ` leahneukirchen
                   ` (9 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 13:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-616567773

Comment:
Implemented (i.e. copied) your implementation. Also added some documentation to `mblaze-profile(5)`. The downside of this implementation is that you end of with a lot of duplicate address in `mblaze-profile(5)` at least for my simple use-case.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (27 preceding siblings ...)
  2020-04-20 13:55 ` nmeum
@ 2020-04-20 13:58 ` leahneukirchen
  2020-04-20 14:08 ` [PR PATCH] [Updated] " nmeum
                   ` (8 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-04-20 13:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-616572197

Comment:
We could default to `Alternative-Mailboxes` when `Reply-From` is unset.

Sorry, I lost track of this PR in my todo list.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (28 preceding siblings ...)
  2020-04-20 13:58 ` leahneukirchen
@ 2020-04-20 14:08 ` nmeum
  2020-04-20 14:12 ` nmeum
                   ` (7 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 14:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 2208 bytes --]

From 4e4dcdf1cab41e975139bf62d666ed16594507df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 20 Apr 2020 15:20:27 +0200
Subject: [PATCH] mrep: Set From header according to To/Cc/Bcc header

If any of the address contained in the aforementioned headers matches an
address configured in the Reply-From header in mblaze-profile(5).

Without this change, mrep(1) uses the mail address configured as
Local-Mailbox for the From header. While generally desirable, I use
different mail addresses for different proposes. As such, I do not
want to reply to mails I received through my work address with my
private email address.
---
 man/mblaze-profile.5 |  3 +++
 mcom                 | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index e1fa01c..11fad7b 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -44,6 +44,9 @@ to recognize messages sent to you.
 A comma-separated list of mail addresses that also belong to you, for
 .Xr mscan 1
 to recognize messages sent by or directly to you.
+.It Li Reply-From\&:
+A comma-separated list of mail addresses that are automatically used for
+the From header in a reply if present in the Cc, To, or Bcc header.
 .It Li FQDN\&:
 The fully qualified domain name used for
 .Li Message\&-Id\&:
diff --git a/mcom b/mcom
index e2f7100..65ebfaf 100755
--- a/mcom
+++ b/mcom
@@ -15,6 +15,11 @@ notmine() {
 	grep -Fv -e "$mine"
 }
 
+replyfrom() {
+	addrs="$(maddr -a -h reply-from: "$MBLAZE/profile")"
+	grep -F -e "$addrs"
+}
+
 ouniq() {
 	awk '!seen[$0]++'
 }
@@ -356,7 +361,15 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n1)
+		if [ -n "$addr" ]; then
+			from=$(maddr -h reply-from "$MBLAZE/profile" | grep -Fi "<$addr>" | head -n1)
+		fi
+		if [ -z "$from" ]; then
+			from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		fi
+
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (29 preceding siblings ...)
  2020-04-20 14:08 ` [PR PATCH] [Updated] " nmeum
@ 2020-04-20 14:12 ` nmeum
  2020-04-20 14:20 ` [PR PATCH] [Updated] " nmeum
                   ` (6 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 14:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-616580590

Comment:
> We could default to `Alternative-Mailboxes` when `Reply-From` is unset.

Sure but imho that would complicate the code a bit (more case distinctions) as the fallback is needed both here:

https://github.com/leahneukirchen/mblaze/blob/4e4dcdf1cab41e975139bf62d666ed16594507df/mcom#L19-L20

and here:

https://github.com/leahneukirchen/mblaze/blob/4e4dcdf1cab41e975139bf62d666ed16594507df/mcom#L367

> Sorry, I lost track of this PR in my todo list.

So did I.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Updated] mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (30 preceding siblings ...)
  2020-04-20 14:12 ` nmeum
@ 2020-04-20 14:20 ` nmeum
  2020-04-20 14:25 ` nmeum
                   ` (5 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

There is an updated pull request by nmeum against master on the mblaze repository

https://github.com/nmeum/mblaze mrep-check-to-and-cc
https://github.com/leahneukirchen/mblaze/pull/173

mrep: Set From header according to To/Cc header
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

A patch file from https://github.com/leahneukirchen/mblaze/pull/173.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mrep-check-to-and-cc-173.patch --]
[-- Type: text/x-diff, Size: 3744 bytes --]

From 4e4dcdf1cab41e975139bf62d666ed16594507df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 20 Apr 2020 15:20:27 +0200
Subject: [PATCH 1/2] mrep: Set From header according to To/Cc/Bcc header

If any of the address contained in the aforementioned headers matches an
address configured in the Reply-From header in mblaze-profile(5).

Without this change, mrep(1) uses the mail address configured as
Local-Mailbox for the From header. While generally desirable, I use
different mail addresses for different proposes. As such, I do not
want to reply to mails I received through my work address with my
private email address.
---
 man/mblaze-profile.5 |  3 +++
 mcom                 | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index e1fa01c..11fad7b 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -44,6 +44,9 @@ to recognize messages sent to you.
 A comma-separated list of mail addresses that also belong to you, for
 .Xr mscan 1
 to recognize messages sent by or directly to you.
+.It Li Reply-From\&:
+A comma-separated list of mail addresses that are automatically used for
+the From header in a reply if present in the Cc, To, or Bcc header.
 .It Li FQDN\&:
 The fully qualified domain name used for
 .Li Message\&-Id\&:
diff --git a/mcom b/mcom
index e2f7100..65ebfaf 100755
--- a/mcom
+++ b/mcom
@@ -15,6 +15,11 @@ notmine() {
 	grep -Fv -e "$mine"
 }
 
+replyfrom() {
+	addrs="$(maddr -a -h reply-from: "$MBLAZE/profile")"
+	grep -F -e "$addrs"
+}
+
 ouniq() {
 	awk '!seen[$0]++'
 }
@@ -356,7 +361,15 @@ fi
 				msed "/body/d" /dev/stdin
 		fi | sed '/^$/d'
 		printf 'Subject: Re: %s\n' "$(COLUMNS=10000 mscan -f '%S' "$1")"
-		from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+
+		addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n1)
+		if [ -n "$addr" ]; then
+			from=$(maddr -h reply-from "$MBLAZE/profile" | grep -Fi "<$addr>" | head -n1)
+		fi
+		if [ -z "$from" ]; then
+			from=$(mhdr -h local-mailbox "$MBLAZE/profile")
+		fi
+
 		[ "$from" ] && printf 'From: %s\n' "$from"
 		mid=$(mhdr -h message-id "$1")
 		if [ "$mid" ]; then

From 326bcbeced509271c4f1280308e012dd2a24fa10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Mon, 20 Apr 2020 16:20:15 +0200
Subject: [PATCH 2/2] mrep: Fallback to Alternative-Mailboxes when Reply-From
 is unset

---
 mcom | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/mcom b/mcom
index 65ebfaf..59eeab8 100755
--- a/mcom
+++ b/mcom
@@ -10,14 +10,18 @@ commajoin() {
 	     END {print l}'
 }
 
-notmine() {
+grepmine() {
 	mine="$(maddr -a -h local-mailbox:alternate-mailboxes: "$MBLAZE/profile")"
-	grep -Fv -e "$mine"
+	grep -F -e "$mine" "$@"
 }
 
 replyfrom() {
 	addrs="$(maddr -a -h reply-from: "$MBLAZE/profile")"
-	grep -F -e "$addrs"
+	if [ -z "$addrs" ]; then
+		grepmine
+	else
+		grep -F -e "$addrs"
+	fi
 }
 
 ouniq() {
@@ -354,7 +358,7 @@ fi
 			printf 'To: %s\n' "$to"
 			printf 'Cc: %s\n' \
 			       "$(mhdr -d -A -h to:cc: "$1" |
-				       notmine |grep -Fv -e "$to" |
+				       grepmine -v |grep -Fv -e "$to" |
 				       ouniq |commajoin)"
 			printf 'Bcc: \n'
 			printf '%s\n' "$hdrs" | awk '{ print }' |
@@ -364,7 +368,8 @@ fi
 
 		addr=$(maddr -a -h to:cc:bcc: "$1" | replyfrom | head -n1)
 		if [ -n "$addr" ]; then
-			from=$(maddr -h reply-from "$MBLAZE/profile" | grep -Fi "<$addr>" | head -n1)
+			from=$(maddr -h reply-from:local-mailbox:alternate-mailboxes: \
+				"$MBLAZE/profile" | grep -Fi "<$addr>" | head -n1)
 		fi
 		if [ -z "$from" ]; then
 			from=$(mhdr -h local-mailbox "$MBLAZE/profile")

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (31 preceding siblings ...)
  2020-04-20 14:20 ` [PR PATCH] [Updated] " nmeum
@ 2020-04-20 14:25 ` nmeum
  2020-05-20  1:40 ` xelxebar
                   ` (4 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: nmeum @ 2020-04-20 14:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-616588304

Comment:
Added some experimental fallback code.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (32 preceding siblings ...)
  2020-04-20 14:25 ` nmeum
@ 2020-05-20  1:40 ` xelxebar
  2020-05-20  1:41 ` xelxebar
                   ` (3 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: xelxebar @ 2020-05-20  1:40 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]

New comment by xelxebar on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-631182431

Comment:
Have my eye on this feature. The list of emails I have to reply as is very long and constantly growing. Would it make sense to allow wildcards or regex specifications in `reply-from` and/or `alternative-mailboxes` specifications?

Unfortunately `*` and `/` can technically appear in the local and domain parts, so we can't use an obvious wildcard syntax like `*@example.com` nor a regex syntax like `/.*@example.com/`. Unwinding the address specification in rfc5322 is a bit of a windy path, but it looks like we could get away with using `\` of the `specials` [0]. AFAICT the backslash can't appear anywhere in an address specification so a regex like `\.*@example.com\` should be easily distinguishable and unambiguous.

Thoughts?

[0]:https://tools.ietf.org/html/rfc5322#section-3.2.3

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (33 preceding siblings ...)
  2020-05-20  1:40 ` xelxebar
@ 2020-05-20  1:41 ` xelxebar
  2020-05-23 13:43 ` leahneukirchen
                   ` (2 subsequent siblings)
  37 siblings, 0 replies; 38+ messages in thread
From: xelxebar @ 2020-05-20  1:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

New comment by xelxebar on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-631182431

Comment:
Have my eye on this feature. The list of emails I have to reply as is very long and constantly growing. Would it make sense to allow wildcards or regex specifications in `reply-from` and/or `alternative-mailboxes` specifications?

Unfortunately `*` and `/` can technically appear in the local and domain parts, so we can't use an obvious wildcard syntax like `*@example.com` nor a regex syntax like `/.*@example.com/`. Unwinding the address specification in rfc5322 is a bit of a windy path, but it looks like we could get away with using `\` of the `specials` (section [3.2.3][0]). AFAICT the backslash can't appear anywhere in an address specification so a regex like `\.*@example.com\` should be easily distinguishable and unambiguous.

Thoughts?

[0]:https://tools.ietf.org/html/rfc5322#section-3.2.3

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (34 preceding siblings ...)
  2020-05-20  1:41 ` xelxebar
@ 2020-05-23 13:43 ` leahneukirchen
  2020-05-23 14:02 ` leahneukirchen
  2020-09-06 14:30 ` [PR PATCH] [Closed]: " leahneukirchen
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-05-23 13:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-633056327

Comment:
Do we really need something more complicated than `@example.com`?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (35 preceding siblings ...)
  2020-05-23 13:43 ` leahneukirchen
@ 2020-05-23 14:02 ` leahneukirchen
  2020-09-06 14:30 ` [PR PATCH] [Closed]: " leahneukirchen
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-05-23 14:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/173#issuecomment-633059832

Comment:
I mangled this into 282de65079f2a543, please test.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PR PATCH] [Closed]: mrep: Set From header according to To/Cc header
       [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
                   ` (36 preceding siblings ...)
  2020-05-23 14:02 ` leahneukirchen
@ 2020-09-06 14:30 ` leahneukirchen
  37 siblings, 0 replies; 38+ messages in thread
From: leahneukirchen @ 2020-09-06 14:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

There's a closed pull request on the mblaze repository

mrep: Set From header according to To/Cc header
https://github.com/leahneukirchen/mblaze/pull/173

Description:
I use different mail addresses for different purposes. When replying to
any email, `mrep(1)` currently uses the mail address configured as
`Local-Mailbox` for the From header. While generally desirable, I do not
want to reply to mails I received through my work address with my
private email address.

This commit introduces a change which uses the email address, the email
was sent to, (as specified by To/Cc) for the From header, as long as this
address was configured as an `Alternate-Mailboxes`. I just quickly hacked
this together as a proof of concept without much further considerations.
Seems to work though but not sure if it is generally desirable to enable
this behaviour by default, let me know what you think.

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2020-09-06 14:30 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-173@inbox.vuxu.org>
2020-03-30 11:22 ` mrep: Set From header according to To/Cc header nmeum
2020-03-30 11:59 ` leahneukirchen
2020-03-30 12:05 ` Duncaen
2020-03-30 12:08 ` Duncaen
2020-03-30 12:09 ` Duncaen
2020-03-30 12:16 ` Duncaen
2020-03-30 12:54 ` nmeum
2020-03-30 13:04 ` leahneukirchen
2020-03-30 14:49 ` nmeum
2020-03-30 14:56 ` leahneukirchen
2020-03-30 17:37 ` [PR PATCH] [Updated] " nmeum
2020-03-30 17:37 ` nmeum
2020-03-30 17:46 ` [PR PATCH] [Updated] " nmeum
2020-03-30 17:48 ` nmeum
2020-03-30 17:50 ` leahneukirchen
2020-03-30 17:56 ` nmeum
2020-03-30 17:56 ` nmeum
2020-03-30 17:56 ` nmeum
2020-03-30 17:57 ` nmeum
2020-03-30 18:02 ` leahneukirchen
2020-03-30 18:04 ` leahneukirchen
2020-03-30 18:44 ` nmeum
2020-04-20 13:43 ` [PR PATCH] [Updated] " nmeum
2020-04-20 13:44 ` nmeum
2020-04-20 13:50 ` nmeum
2020-04-20 13:51 ` nmeum
2020-04-20 13:55 ` nmeum
2020-04-20 13:55 ` nmeum
2020-04-20 13:58 ` leahneukirchen
2020-04-20 14:08 ` [PR PATCH] [Updated] " nmeum
2020-04-20 14:12 ` nmeum
2020-04-20 14:20 ` [PR PATCH] [Updated] " nmeum
2020-04-20 14:25 ` nmeum
2020-05-20  1:40 ` xelxebar
2020-05-20  1:41 ` xelxebar
2020-05-23 13:43 ` leahneukirchen
2020-05-23 14:02 ` leahneukirchen
2020-09-06 14:30 ` [PR PATCH] [Closed]: " leahneukirchen

Github messages for mblaze

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/mblaze-github

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 mblaze-github mblaze-github/ http://inbox.vuxu.org/mblaze-github \
		mblaze-github@inbox.vuxu.org
	public-inbox-index mblaze-github

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.mblaze


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git