aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorshtrophic <christoph@liebender.dev>2025-01-24 22:24:05 +0100
committershtrophic <christoph@liebender.dev>2025-01-24 22:24:05 +0100
commit3d96c576287736ebdf87e4a7b956842a6c6e055f (patch)
treead5f4cc5ebc9913ccfd753edfc934b82e34be72e /tests
parent1c4c15540360a5db9d56e6ae8d206a1f30a4f52b (diff)
enforce tls when supported && add tests
Diffstat (limited to 'tests')
-rw-r--r--tests/smtp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/smtp.c b/tests/smtp.c
new file mode 100644
index 0000000..1100a9d
--- /dev/null
+++ b/tests/smtp.c
@@ -0,0 +1,24 @@
+/* snac - A simple, minimalistic ActivityPub instance */
+/* copyright (c) 2022 - 2025 grunfink et al. / MIT license */
+
+#define XS_IMPLEMENTATION
+#include "../xs.h"
+#include "../xs_curl.h"
+
+#define FROM "<snac-smtp-test@locahost>"
+
+int main(void) {
+ xs *to = xs_fmt("<%s@localhost>", getenv("USER")),
+ *body = xs_fmt(""
+ "To: %s \r\n"
+ "From: " FROM "\r\n"
+ "Subject: snac smtp test\r\n"
+ "\r\n"
+ "If you read this as an email, it probably worked!\r\n",
+ to);
+
+ return xs_smtp_request("smtp://localhost", NULL, NULL,
+ FROM,
+ to,
+ body, 0);
+} \ No newline at end of file