diff options
Diffstat (limited to 'lib/rfc822/message.go')
-rw-r--r-- | lib/rfc822/message.go | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/rfc822/message.go b/lib/rfc822/message.go index f511ea19..391ab3e5 100644 --- a/lib/rfc822/message.go +++ b/lib/rfc822/message.go @@ -277,18 +277,15 @@ func parseReceivedHeader(h *mail.Header) (time.Time, error) { } func parseAddressList(h *mail.Header, key string) ([]*mail.Address, error) { - hdr, err := h.Text(key) - if err != nil && !message.IsUnknownCharset(err) { + addrs, err := h.AddressList(key) + if len(addrs) == 0 { + // Only consider the error if the returned address list is empty + // Sometimes, we get a list of addresses and unknown charset + // errors which are not fatal. return nil, err } - if hdr == "" { - return nil, nil - } - add, err := mail.ParseAddressList(hdr) - if err != nil { - return []*mail.Address{{Name: hdr}}, nil - } - return add, err + // If we got at least one address, ignore any returned error. + return addrs, nil } // RawMessage is an interface that describes a raw message |