Files
patrickandClaude Sonnet 5.5 b15bab355b feat(PROJ-91): Envelope-Absender (Return-Path) durchsuchbar machen
Parser liest oberstes Return-Path, Index-Spalte env_from, Absender-Filter
matcht from_addr oder env_from. Keine Zugriffswirkung. Reindex für Bestand nötig.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-29 13:48:36 +01:00

25 lines
498 B
Go

package mailparser
import (
"net/mail"
"strings"
)
// Only the topmost Return-Path counts: it is added by the final delivering
// mailserver; lower ones stem from earlier hops or the sender.
func returnPath(h mail.Header) string {
values := h["Return-Path"]
if len(values) == 0 {
return ""
}
v := strings.TrimSpace(values[0])
if v == "" || v == "<>" {
return ""
}
a, err := mail.ParseAddress(v)
if err != nil {
return ""
}
return strings.ToLower(strings.TrimSpace(a.Address))
}