|
DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Outbound SMTP client (RFC 5321) - send a device email alert. More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Classes | |
| struct | SmtpConfig |
| Server address + credentials for one send. Addresses are bare (no angle brackets). More... | |
| struct | SmtpMessage |
| One plain-text message. More... | |
Typedefs | |
| typedef 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, so it can run against a real socket or a test mock. | |
| typedef int(* | SmtpRecvFn) (void *ctx, uint8_t *buf, size_t cap) |
Enumerations | |
| enum class | SmtpResult : int32_t { SMTP_OK = 0 , SMTP_ERR_ARG = -1 , SMTP_ERR_CONNECT = -2 , SMTP_ERR_TLS = -3 , SMTP_ERR_IO = -4 , SMTP_ERR_PROTOCOL = -5 , SMTP_ERR_AUTH = -6 , SMTP_ERR_OVERFLOW = -7 } |
| Result of an SMTP send. 0 is success; every failure is a distinct negative code. More... | |
Functions | |
| 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 scripted transport. | |
| SmtpResult | smtp_send (const SmtpConfig *cfg, const SmtpMessage *msg) |
Blocking one-shot send over the real transport (det_client, plus TLS when cfg->tls). Opens the connection, runs smtp_run(), and closes. | |
Outbound SMTP client (RFC 5321) - send a device email alert.
A blocking one-shot: connect, greet, optional AUTH LOGIN, then MAIL FROM / RCPT TO / DATA a plain-text message and QUIT. It rides the shared outbound client transport (det_client), with implicit TLS (SMTPS, typically port 465) when the config sets tls and DETWS_ENABLE_TLS is on. Zero heap; every buffer is a compile-time size (DETWS_SMTP_*). Gated by DETWS_ENABLE_SMTP.
The dialogue itself (smtp_run) is written against a send/recv seam, so the whole protocol exchange - greeting codes, AUTH, dot-stuffing, the terminating . - is unit-tested on the host with a scripted mock server, no lwIP or TLS required.
"SMS fallback" needs no extra code: most mobile carriers accept an email-to-SMS gateway address (e.g. 5551234567@txt.example.net) as the recipient.
Definition in file smtp.h.
| typedef 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, so it can run against a real socket or a test mock.
len), or <0 on error. | typedef int(* SmtpRecvFn) (void *ctx, uint8_t *buf, size_t cap) |
|
strong |
Result of an SMTP send. 0 is success; every failure is a distinct negative code.
| 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 scripted transport.
| SmtpResult smtp_send | ( | const SmtpConfig * | cfg, |
| const SmtpMessage * | msg | ||
| ) |
Blocking one-shot send over the real transport (det_client, plus TLS when cfg->tls). Opens the connection, runs smtp_run(), and closes.