ParseAddressList in Go
ParseAddressList parses the given string as a list of addresses.
package main
import (
"fmt"
"log"
"net/mail"
)
func main() {
const list = "Alice <alice@example.com>, Bob <bob@example.com>, Eve <eve@example.com>"
emails, err := mail.ParseAddressList(list)
if err != nil {
log.Fatal(err)
}
for _, v := range emails {
fmt.Println(v.Name, v.Address)
}
}