don't "domain block" address literals
[ghsmtp.git] / OpenDKIM-test.cpp
blobe74767430eae92e5f6e2877fba8e0be849c6a6bc
1 #include "OpenDKIM.hpp"
3 #include <fstream>
4 #include <iomanip>
5 #include <iostream>
6 #include <iterator>
8 #include <fmt/format.h>
10 #include <glog/logging.h>
12 int main(int argc, char* argv[])
14 auto const body_type = OpenDKIM::sign::body_type::text;
16 auto const key_file = "ghsmtp.private";
17 std::ifstream keyfs(key_file);
18 CHECK(keyfs.good()) << "can't access " << key_file;
20 std::string key(std::istreambuf_iterator<char>{keyfs}, {});
22 OpenDKIM::sign dks(key.c_str(), "ghsmtp", "digilicious.com", body_type);
24 dks.header("from: gene@digilicious.com");
25 dks.header("to: gene@digilicious.com");
26 dks.eoh();
28 dks.body("foo\r\nbar\r\nbaz\r\n");
29 dks.eom();
31 fmt::print("DKIM-Signature: {}\n", dks.getsighdr());