An SMTP client and server library for Zig implementing RFC 5321.
0

Configure Feed

Select the types of activity you want to include in your feed.

Put the std.Io argument first in function signatures

Project convention: io comes first in any function taking a std.Io
(after the receiver, for methods). The one violation was Tls.init,
which took (t, gpa, io, ...) and is now (t, io, gpa, ...); callers and
documentation examples updated to match.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012HBHFhoTYa8TU9GLwobfbx

+6 -6
+2 -2
README.md
··· 75 75 76 76 ```zig 77 77 var tls: zsmtp.Tls = undefined; 78 - try tls.init(gpa, io, &stream_reader.interface, &stream_writer.interface, .{ 78 + try tls.init(io, gpa, &stream_reader.interface, &stream_writer.interface, .{ 79 79 .host = "smtp.example.com", 80 80 }); 81 81 defer tls.deinit(gpa); ··· 92 92 _ = try client.hello("my-host.example.com"); // check .starttls in the result 93 93 try client.starttls(); 94 94 var tls: zsmtp.Tls = undefined; 95 - try tls.init(gpa, io, &stream_reader.interface, &stream_writer.interface, .{ 95 + try tls.init(io, gpa, &stream_reader.interface, &stream_writer.interface, .{ 96 96 .host = "smtp.example.com", 97 97 }); 98 98 client.setTransport(tls.reader(), tls.writer());
+2 -2
src/Tls.zig
··· 17 17 //! 18 18 //! ``` 19 19 //! var tls_transport: Tls = undefined; 20 - //! try tls_transport.init(gpa, io, &stream_reader.interface, 20 + //! try tls_transport.init(io, gpa, &stream_reader.interface, 21 21 //! &stream_writer.interface, .{ .host = "smtp.example.com" }); 22 22 //! ``` 23 23 ··· 61 61 /// Allocates plaintext buffers from `gpa`; free them with `deinit`. 62 62 pub fn init( 63 63 t: *Tls, 64 - gpa: std.mem.Allocator, 65 64 io: Io, 65 + gpa: std.mem.Allocator, 66 66 input: *Io.Reader, 67 67 output: *Io.Writer, 68 68 options: Options,
+2 -2
src/main.zig
··· 160 160 var client: zsmtp.Client = .init(&stream_reader.interface, &stream_writer.interface, &reply_buf); 161 161 162 162 if (config.mode == .tls) { 163 - try tls.init(arena, io, &stream_reader.interface, &stream_writer.interface, tls_options); 163 + try tls.init(io, arena, &stream_reader.interface, &stream_writer.interface, tls_options); 164 164 tls_active = true; 165 165 client.setTransport(tls.reader(), tls.writer()); 166 166 } ··· 170 170 171 171 if (config.mode == .starttls) { 172 172 try client.starttls(); 173 - try tls.init(arena, io, &stream_reader.interface, &stream_writer.interface, tls_options); 173 + try tls.init(io, arena, &stream_reader.interface, &stream_writer.interface, tls_options); 174 174 tls_active = true; 175 175 client.setTransport(tls.reader(), tls.writer()); 176 176 extensions = try client.hello("localhost");