Go net/mail: parse mail messages and addresses
Answer: Package mail implements parsing of mail messages. For the most part it follows syntax specified by RFC 5322 and extended by RFC 6532. Obsolete address formats are not parsed.
What the parser covers
The package implements parsing of mail messages.
For the most part, the syntax follows RFC 5322, with extensions from RFC 6532.
Obsolete address formats are not parsed, including addresses with embedded route information.
No unicode normalization is performed.
The full range of spacing, known as the CFWS syntax element, is not supported, such as breaking addresses across lines.
The source comment
The source comment also describes parsing of mail messages.
It follows syntax specified by RFC 5322 and extended by RFC 6532.
Addresses with embedded route information are among the obsolete formats that are not parsed.
Unicode normalization is not performed on the text.
See also
Claims
- id: C1 claim: The package implements parsing of mail messages. source: S1 evidence: "Package mail implements parsing of mail messages."
- id: C2 claim: It follows RFC 5322, extended by RFC 6532. source: S1 evidence: "specified by RFC 5322 and extended by RFC 6532"
- id: C3 claim: The source comment also describes parsing of mail messages. source: S2 evidence: "Package mail implements parsing of mail messages."
- id: C4 claim: Obsolete address formats are not parsed. source: S2 evidence: "Obsolete address formats are not parsed"
Sources
- [S1] net/mail package reference. Go. https://pkg.go.dev/net/mail . License: BSD-3-Clause. Accessed 2026-11-23.
- [S2] net/mail source. Go. https://go.dev/src/net/mail/message.go . License: BSD-3-Clause. Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go, net/mail package reference; Go, net/mail source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go, net/mail package reference; Go, net/mail source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go net/mail: parse mail messages and addresses." iinventedlight Library, iil:note:epvk3dv0, version of 2026-11-23. https://iinventedlight.com/library/notes/go-net-mail/. License: CC-BY-4.0.
@misc{iil_note_epvk3dv0,
author = {{iinventedlight}},
title = {{Go net/mail: parse mail messages and addresses}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/go-net-mail/},
note = {Permanent ID iil:note:epvk3dv0. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-net-mail.schema.json (schema; CC-BY-4.0)
- go-net-mail.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-net-mail.md.