handle multiple emails in header 'To'

This commit is contained in:
Aine
2023-01-09 16:23:54 +02:00
parent 1e9558c1fc
commit ac9c27aa32
3 changed files with 7 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"net/mail"
"regexp"
"strings"
"time"
"maunium.net/go/mautrix/id"
@@ -26,6 +27,10 @@ func MessageID(eventID id.EventID, domain string) string {
func Address(email string) string {
addr, _ := mail.ParseAddress(email) //nolint:errcheck // if it fails here, nothing will help
if addr == nil {
list := AddressList(email)
if len(list) > 0 {
return strings.Join(list, ",")
}
return email
}