aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: c61fd3dcea374cd24156b4846487774c36d403c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# smtp-zig

SMTP client library for zig.

WORK IN PROGRESS. 

TODO: 
- [ ] Dot encoding/escaping
- [ ] Lots more tests
- [ ] Support more extensions and authentication mechanisms
- [ ] Zig package management

Code example:
```zig
const std = @import("std");
const smtp = @import("smtp");
const Client = smtp.Client;

pub fn main() !void {
    const mail = 
    \\Subject: test
    \\From: <martin@mfashby.net>
    \\To: <martin@mfashby.net>
    \\
    \\This is a test message
    ;
    const user = std.os.getenv("SMTP_USERNAME").?;
    const pass = std.os.getenv("SMTP_PASSWORD").?;
    var client = try Client.init(std.heap.page_allocator, "mail.mfashby.net:587", .{.user = user, .pass = pass});
    defer client.deinit();
    try client.send_mail("martin@mfashby.net", &[_][]const u8{"martin@mfashby.net"}, mail);
    try client.quit();
}
```

This project is licensed under the terms of the MIT license.