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:
parent
932201fa23
commit
fc4458bfbb
|
@ -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 != ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue