An SMTP client and server library for Zig implementing RFC 5321.
1// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>
2// SPDX-License-Identifier: MIT
3
4//! zig-smtp — an SMTP client and server library for Zig
5//! ([RFC 5321](https://datatracker.ietf.org/doc/html/rfc5321)).
6//!
7//! Both `Client` and `Server` run over plain `std.Io.Reader`/`std.Io.Writer`
8//! pairs, so they work with any transport: TCP streams, in-memory buffers in
9//! tests, or the `Tls` layer. The lower-level protocol pieces — reply
10//! parsing, command parsing, dot-stuffing — are exposed via `protocol`.
11
12const std = @import("std");
13
14pub const protocol = @import("protocol.zig");
15pub const Reply = protocol.Reply;
16pub const Command = protocol.Command;
17pub const Client = @import("Client.zig");
18pub const Server = @import("Server.zig");
19pub const Tls = @import("Tls.zig");
20/// Re-export of the ianic/tls.zig library used for server-side STARTTLS,
21/// e.g. `smtp.tls.config.CertKeyPair` for loading the server certificate.
22pub const tls = @import("tls");
23/// Re-export of [zig-sasl](https://git.jcollie.dev/jeff/zig-sasl), which is
24/// where the AUTH mechanisms live: `smtp.sasl.Plain`, `sasl.CramMd5`,
25/// `sasl.XOAuth2` and the rest, for handing to `Client.authenticate`. They
26/// are not here because nothing about them is specific to SMTP — POP3 and
27/// IMAP want the same ones.
28pub const sasl = @import("sasl");
29
30test {
31 _ = protocol;
32 _ = Client;
33 _ = Server;
34 _ = Tls;
35}