Standard library / net/mail

mail.AddressParser.ParseList()

Parse a list using the configured word decoder. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
func (p *AddressParser) ParseList(list string) ([]*Address, error)

Parameters & Attributes

NameTypeDescription
liststringComma-separated mailbox address list.

Return Value

([]*Address, error)

Mailbox list and error.

Working Example

Example Snippetgo
package main
import (  "fmt"  "net/mail")
func main() {  var p mail.AddressParser  v := must(p.ParseList("a@example.invalid, b@example.invalid"))  fmt.Println(len(v))}
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