1 #include "OpenDKIM.hpp"
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");
28 dks
.body("foo\r\nbar\r\nbaz\r\n");
31 fmt::print("DKIM-Signature: {}\n", dks
.getsighdr());