Skip to content

Commit

Permalink
mail: use message.CharsetReader in parseAddressList
Browse files Browse the repository at this point in the history
This allows for headers which are encoded with an unusual encoding.
  • Loading branch information
brunnre8 authored and emersion committed Aug 13, 2019
1 parent b6482e3 commit d512711
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mail/address.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package mail

import (
"mime"
"net/mail"
"strings"

"github.com/emersion/go-message"
)

// Address represents a single mail address.
Expand All @@ -16,7 +19,10 @@ func (a *Address) String() string {
}

func parseAddressList(s string) ([]*Address, error) {
list, err := mail.ParseAddressList(s)
parser := mail.AddressParser{
&mime.WordDecoder{message.CharsetReader},
}
list, err := parser.ParseList(s)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d512711

Please sign in to comment.