set sender and reply-to only if dkim does not prevent it
This commit is contained in:
parent
e06ebb4d30
commit
3c4a2651e7
10
picolist.go
10
picolist.go
|
@ -102,16 +102,26 @@ func isAllowed(mail *mail.Message, f flags, owners hashset) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setHeaderFields(mail *mail.Message, listname string, f flags) {
|
func setHeaderFields(mail *mail.Message, listname string, f flags) {
|
||||||
|
dkim := mail.Header.Get("DKIM-Signature")
|
||||||
|
canChange := func(headerName string) bool {
|
||||||
|
headerName = ":" + headerName + ":"
|
||||||
|
headerNameLower := strings.ToLower(headerName)
|
||||||
|
return dkim == "" || (!strings.Contains(dkim, headerName) && !strings.Contains(dkim, headerNameLower))
|
||||||
|
}
|
||||||
bounceAddress := []string{"<" + f.returnPath() + ">"}
|
bounceAddress := []string{"<" + f.returnPath() + ">"}
|
||||||
listAddress := []string{"<" + listname + ">"}
|
listAddress := []string{"<" + listname + ">"}
|
||||||
mail.Header["Precedence"] = []string{"list"}
|
mail.Header["Precedence"] = []string{"list"}
|
||||||
|
if canChange("Sender") {
|
||||||
mail.Header["Sender"] = bounceAddress
|
mail.Header["Sender"] = bounceAddress
|
||||||
|
}
|
||||||
mail.Header["Errors-To"] = bounceAddress
|
mail.Header["Errors-To"] = bounceAddress
|
||||||
mail.Header["List-Id"] = listAddress
|
mail.Header["List-Id"] = listAddress
|
||||||
if !f.newsletter {
|
if !f.newsletter {
|
||||||
mail.Header["List-Post"] = []string{"<mailto:" + listname + ">"}
|
mail.Header["List-Post"] = []string{"<mailto:" + listname + ">"}
|
||||||
|
if canChange("Reply-To") {
|
||||||
mail.Header["Reply-To"] = listAddress
|
mail.Header["Reply-To"] = listAddress
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func recipients(members hashset) ([]bulkRecipients, error) {
|
func recipients(members hashset) ([]bulkRecipients, error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user