Standard library / net/mail

mail.Header

Represent message header names and lists of values. Use canonical keys when constructing the map directly. Expected stdout: 'one 2\n'.

Formal Syntax & Structure

go syntaxgo
type Header map[string][]string

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/mail")
func main() {  h := mail.Header{"Subject": {"one", "two"}}  fmt.Println(h.Get("subject"), len(h["Subject"]))}
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