Made the error clearer when an address is invalid
This commit is contained in:
parent
4291610152
commit
92eaa13340
9
send.go
9
send.go
|
@ -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
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue