diff --git a/webmail/message.go b/webmail/message.go index cd07457..73cb822 100644 --- a/webmail/message.go +++ b/webmail/message.go @@ -369,23 +369,31 @@ func parseListPostAddress(s string) *MessageAddress { List-Post: (Postings are Moderated) List-Post: List-Post: NO (posting not allowed on this list) + List-Post: , */ s = strings.TrimSpace(s) - if !strings.HasPrefix(s, "") + if !found { + return nil + } + if strings.HasPrefix(addr, "mailto:") { + u, err := url.Parse(addr) + if err != nil { + return nil + } + addr, err := smtp.ParseAddress(u.Opaque) + if err != nil { + return nil + } + return &MessageAddress{User: addr.Localpart.String(), Domain: addr.Domain} + } + s = strings.TrimSpace(ns) + s = strings.TrimPrefix(s, ",") + s = strings.TrimSpace(s) } - s = s[1:] - s, _, found := strings.Cut(s, ">") - if !found { - return nil - } - u, err := url.Parse(s) - if err != nil { - return nil - } - addr, err := smtp.ParseAddress(u.Opaque) - if err != nil { - return nil - } - return &MessageAddress{User: addr.Localpart.String(), Domain: addr.Domain} + return nil } diff --git a/webmail/message_test.go b/webmail/message_test.go index e7d275a..3495172 100644 --- a/webmail/message_test.go +++ b/webmail/message_test.go @@ -45,5 +45,6 @@ func TestParseListPostAddress(t *testing.T) { check(" (Postings are Moderated)", &MessageAddress{User: "moderator", Domain: dns.Domain{ASCII: "host.com"}}) check("", &MessageAddress{User: "moderator", Domain: dns.Domain{ASCII: "host.com"}}) check("NO (posting not allowed on this list)", nil) + check(", ", &MessageAddress{User: "golang-dev", Domain: dns.Domain{ASCII: "googlegroups.com"}}) check("", nil) }