Something went wrong. Try again.
Reading, writing and creating MIME and RFC 5322 email messages in Zig.
Something went wrong. Try again.
Files
- Zig 98%
- Nix 2%
README.md
<!--
SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>
SPDX-License-Identifier: MIT
-->
# zig-mime
Email messages for Zig 0.17: reading them, writing them, and building them
from nothing. RFC 5322 and the five MIME documents, with the thirty years of
other people's software that came after them taken into account.
```console
$ zig build
$ ./zig-out/bin/zig-mime tree message.eml
multipart/mixed 2 parts
multipart/related 2 parts
multipart/alternative 2 parts
text/plain [quoted-printable] 55 bytes
text/html [quoted-printable] 159 bytes
image/png [base64] "logo.png" cid:1f13baa8@example.com 38 bytes
application/pdf [base64] "café.pdf" (attachment) 26 bytes
```
Three layers, and you can stop at any of them:
| | |
| --- | --- |
| the codecs | [base64, quoted-printable, encoded words](#the-codecs) — pure functions over bytes, no allocation you did not ask for |
| the headers | [addresses, dates, media types, parameters](#the-headers) — each header's own grammar, parsed and written |
| `mime.Message` | [the whole message](#reading-a-message) as a tree of parts, and [the builder](#building-a-message) that makes one |
| `zig-mime` | [a command-line tool](#the-command-line-tool), which exists to show what all that looks like from outside |
The [API documentation](https://jeff.jcollie.page/zig-mime/) is generated from
the doc comments, which are most of the explanation of why mail is the shape it
is.
## Where this lives
The repository lives in three places that carry the same history. The Forgejo
instance at <https://git.jcollie.dev/jeff/zig-mime> is the web-visible one,
and is where the continuous integration and the published documentation are:
```console
$ git clone https://git.jcollie.dev/jeff/zig-mime.git
```
It is mirrored on Tangled at <https://tangled.org/jcollie.dev/zig-mime>, a
forge built on the AT Protocol, where a repository is addressed by its owner's
identity rather than by a server name.
It is also on [Radicle][radicle], a peer-to-peer forge that needs no acc…