main v/snac0 / tests / smtp.c
 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}