diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/smtp.c | 24 |
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 | |||
| 10 | int 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 | ||