Standard library / net/mail

mail.Address

Represent a mailbox with optional display name and address. Constructing this struct does not validate the address. Expected stdout: 'Ada ada@example.invalid\n'.

Formal Syntax & Structure

go syntaxgo
type Address struct {  Name    string  Address string}

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/mail")
func main() {  v := mail.Address{Name: "Ada", Address: "ada@example.invalid"}  fmt.Println(v.Name, 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)  }}
Go Reference