0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-03-12 22:51:44 -05:00

interpret Precedence: auto_reply as an auto reply (#7137)

Some email clients like to be special and only set the "Precedence" header to "auto_reply" when sending automatic replies.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7137
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: christopher-besch <mail@chris-besch.com>
Co-committed-by: christopher-besch <mail@chris-besch.com>
This commit is contained in:
christopher-besch 2025-03-06 12:49:24 +00:00 committed by Otto
parent 932201fa23
commit fc4458bfbb
2 changed files with 10 additions and 0 deletions

View file

@ -297,6 +297,10 @@ func isAutomaticReply(env *enmime.Envelope) bool {
if autoReply == "yes" { if autoReply == "yes" {
return true return true
} }
precedence := env.GetHeader("Precedence")
if precedence == "auto_reply" {
return true
}
autoRespond := env.GetHeader("X-Autorespond") autoRespond := env.GetHeader("X-Autorespond")
return autoRespond != "" return autoRespond != ""
} }

View file

@ -65,6 +65,12 @@ func TestIsAutomaticReply(t *testing.T) {
}, },
Expected: true, Expected: true,
}, },
{
Headers: map[string]string{
"Precedence": "auto_reply",
},
Expected: true,
},
} }
for _, c := range cases { for _, c := range cases {