Selaa lähdekoodia

Fixed bug which didn't allow for <> in To addresses

Jordan 11 vuotta sitten
vanhempi
commit
aeb36a789a
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      email.go

+ 4 - 0
email.go

@@ -194,6 +194,10 @@ func (e *Email) Send(addr string, a smtp.Auth) error {
 	// Merge the To, Cc, and Bcc fields
 	to := make([]string, 0, len(e.To)+len(e.Cc)+len(e.Bcc))
 	to = append(append(append(to, e.To...), e.Cc...), e.Bcc...)
+	for i := 0; i < len(to); i++ {
+		addr, _ := mail.ParseAddress(to[i])
+		to[i] = addr.Address
+	}
 	// Check to make sure there is at least one recipient and one "From" address
 	if e.From == "" || len(to) == 0 {
 		return errors.New("Must specify at least one From address and one To address")