Standard library / net/mail
mail.AddressParser.Parse()
Parse one mailbox using the configured word decoder. Expected stdout: 'ada@example.invalid\n'.
Formal Syntax & Structure
go syntaxgo
func (p *AddressParser) Parse(address string) (*Address, error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| address | string | One mailbox address, optionally with display name. |
Return Value
(*Address, error)
Parsed mailbox and error.
Working Example
Example Snippetgo
package main
import ( "fmt" "net/mail")
func main() { var p mail.AddressParser v := must(p.Parse("ada@example.invalid")) fmt.Println(v.Address)}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}