25#ifndef DETERMINISTICESPASYNCWEBSERVER_SMTP_H
26#define DETERMINISTICESPASYNCWEBSERVER_SMTP_H
51typedef int (*
SmtpSendFn)(
void *ctx,
const uint8_t *data,
size_t len);
52typedef int (*
SmtpRecvFn)(
void *ctx, uint8_t *buf,
size_t cap);
SmtpResult smtp_send(const SmtpConfig *cfg, const SmtpMessage *msg)
Blocking one-shot send over the real transport (det_client, plus TLS when cfg->tls)....
int(* SmtpSendFn)(void *ctx, const uint8_t *data, size_t len)
Transport seam for smtp_run(): the engine sends and receives raw bytes only through these,...
SmtpResult
Result of an SMTP send. 0 is success; every failure is a distinct negative code.
@ SMTP_ERR_IO
a send/recv failed or the reply timed out
@ SMTP_ERR_ARG
a required field (host / from / to) was null or empty
@ SMTP_ERR_AUTH
AUTH was rejected (bad user/password)
@ SMTP_ERR_OVERFLOW
a command line or the message exceeded its fixed buffer
@ SMTP_ERR_TLS
the TLS handshake failed (SMTPS)
@ SMTP_ERR_PROTOCOL
the server returned an unexpected reply code
@ SMTP_ERR_CONNECT
could not open the transport (DNS / connect)
int(* SmtpRecvFn)(void *ctx, uint8_t *buf, size_t cap)
SmtpResult smtp_run(const SmtpConfig *cfg, const SmtpMessage *msg, SmtpSendFn send, SmtpRecvFn recv, void *ctx)
Drive the full SMTP exchange over send / recv. Pure - no lwIP or TLS - so it is host-testable with a ...
Server address + credentials for one send. Addresses are bare (no angle brackets).
const char * user
AUTH LOGIN username (null or empty => skip AUTH)
bool tls
true = implicit TLS on connect (SMTPS); false = plaintext
const char * pass
AUTH LOGIN password.
const char * from
envelope sender + From: header address
uint16_t port
25 / 587 / 465
const char * host
server hostname (also the TLS SNI name)
const char * helo
EHLO domain to announce (null => "esp32")
const char * body
plain-text UTF-8 body; LF or CRLF line ends, dot-stuffed for you
const char * to
single recipient address (envelope + To: header)
const char * subject
Subject: header (null => empty)