File: smtp.c

package info (click to toggle)
snac2 2.88-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,800 kB
  • sloc: ansic: 22,685; sh: 179; makefile: 69; python: 34
file content (24 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}