Made the error clearer when an address is invalid

This commit is contained in:
Alexandre Cesaro 2016-04-11 23:18:11 +02:00
parent 4291610152
commit 92eaa13340
1 changed files with 4 additions and 5 deletions

View File

@ -108,10 +108,9 @@ func addAddress(list []string, addr string) []string {
} }
func parseAddress(field string) (string, error) { func parseAddress(field string) (string, error) {
a, err := mail.ParseAddress(field) addr, err := mail.ParseAddress(field)
if a == nil { if err != nil {
return "", err return "", fmt.Errorf("gomail: invalid address %q: %v", field, err)
} }
return addr.Address, nil
return a.Address, err
} }