diff options
| author | 2025-04-27 03:11:57 +0000 | |
|---|---|---|
| committer | 2025-04-27 03:11:57 +0000 | |
| commit | 169c5c8c070c527e7462e6ac86b916e94649c1ac (patch) | |
| tree | f1ce03b950a278a1985526cb58dc4e879c3ab046 /tests | |
| parent | Updated RELEASE_NOTES. (diff) | |
| parent | default to `smtp://localhost` (diff) | |
| download | snac2-169c5c8c070c527e7462e6ac86b916e94649c1ac.tar.gz snac2-169c5c8c070c527e7462e6ac86b916e94649c1ac.tar.xz snac2-169c5c8c070c527e7462e6ac86b916e94649c1ac.zip | |
Merge pull request 'do email notifications with CURL' (#283) from shtrophic/snac2:curl-smtp into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/283
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 | ||