smtp-zig

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

README.md (908B)


      1 # smtp-zig
      2 
      3 SMTP client library for zig.
      4 
      5 WORK IN PROGRESS. 
      6 
      7 TODO: 
      8 - [ ] Dot encoding/escaping
      9 - [ ] Lots more tests
     10 - [ ] Support more extensions and authentication mechanisms
     11 - [ ] Zig package management
     12 
     13 Code example:
     14 ```zig
     15 const std = @import("std");
     16 const smtp = @import("smtp");
     17 const Client = smtp.Client;
     18 
     19 pub fn main() !void {
     20     const mail = 
     21     \\Subject: test
     22     \\From: <martin@mfashby.net>
     23     \\To: <martin@mfashby.net>
     24     \\
     25     \\This is a test message
     26     ;
     27     const user = std.os.getenv("SMTP_USERNAME").?;
     28     const pass = std.os.getenv("SMTP_PASSWORD").?;
     29     var client = try Client.init(std.heap.page_allocator, "mail.mfashby.net:587", .{.user = user, .pass = pass});
     30     defer client.deinit();
     31     try client.send_mail("martin@mfashby.net", &[_][]const u8{"martin@mfashby.net"}, mail);
     32     try client.quit();
     33 }
     34 ```
     35 
     36 This project is licensed under the terms of the MIT license.