summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar shtrophic2025-01-24 22:24:05 +0100
committerGravatar shtrophic2025-01-24 22:24:05 +0100
commit3d96c576287736ebdf87e4a7b956842a6c6e055f (patch)
treead5f4cc5ebc9913ccfd753edfc934b82e34be72e /tests
parentadd tests subdirectory with makefile target (diff)
downloadpenes-snac2-3d96c576287736ebdf87e4a7b956842a6c6e055f.tar.gz
penes-snac2-3d96c576287736ebdf87e4a7b956842a6c6e055f.tar.xz
penes-snac2-3d96c576287736ebdf87e4a7b956842a6c6e055f.zip
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 @@
1/* snac - A simple, minimalistic ActivityPub instance */
2/* copyright (c) 2022 - 2025 grunfink et al. / MIT license */
3
4#define XS_IMPLEMENTATION
5#include "../xs.h"
6#include "../xs_curl.h"
7
8#define FROM "<snac-smtp-test@locahost>"
9
10int main(void) {
11 xs *to = xs_fmt("<%s@localhost>", getenv("USER")),
12 *body = xs_fmt(""
13 "To: %s \r\n"
14 "From: " FROM "\r\n"
15 "Subject: snac smtp test\r\n"
16 "\r\n"
17 "If you read this as an email, it probably worked!\r\n",
18 to);
19
20 return xs_smtp_request("smtp://localhost", NULL, NULL,
21 FROM,
22 to,
23 body, 0);
24} \ No newline at end of file