"" /> "" />

ParseAddress in Go

Posted by GoDoc
Public (Editable by Users)

ParseAddress parses a single RFC 5322 address, e.g. "Barry Gibbs "

Go
Edit
package main

import (
	"fmt"
	"log"
	"net/mail"
)

func main() {
	e, err := mail.ParseAddress("Alice <alice@example.com>")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(e.Name, e.Address)
}