This is a creation in Article, where the information may have evolved or changed.
The Net/mail package implements the ability to parse mail messages
Most of this package adheres to the syntax specified in RFC 5322, and the notable differences are:
Old format addresses and addresses embedded in remote information are not resolved
Group address is not parsed
All spacers (CFWS syntax elements) are not supported, such as two-line addresses
Function:
Func parseaddresslist (List string) ([]*address, error)//The function resolves the address list represented by the given character form to the standard address lists.
Type address//The struct represents a separate mail address, one address: "Barry Gibbs <bg@example.com>" will become address{name after address parsing: "Barry Gibbs", Address: "Bg@example.com"}.
Type Address struct { name //Proper name; //User@domain}
Func parseaddress (Address string) (*address, error)//Resolves a separate RFC 5322 address, such as: "Barry Gibbs <bg@example.com>"
Func (a *address) string () string//represents the address represented by a as a legitimate RFC 5322 address string. If the Name field contains non-ASCII characters, it is escaped according to RFC 2047.
The type header//header represents the Key-value pair on the head of a mail message.
Type Header map[string][]string
Func (H Header) AddressList (key String) ([]*address, error)//resolves the value (string) corresponding to the keys key as a list of mailbox addresses and returns
Func (H Header) Date () (time. Time, error)//Gets the value of date in the header
The func (H Header) Get (key string) string//returns the first value assigned to the specified key in the Header. If the key has no value, return ""
Type message//represents a parsed mail message
Type Message struct { header header Body io. Reader}
Func readmessage (R io. Reader) (msg *message, err Error)//reads a message from R, resolves the message header field, and the message body can be from r/msg. Read in the body.
Illustrate usage.
Reference: http://golang.org/pkg/net/mail/