lwIP  2.1.0
Lightweight IP stack
smtp.c File Reference
#include "lwip/apps/smtp.h"
#include "lwip/sys.h"
#include "lwip/sockets.h"
#include "lwip/altcp.h"
#include "lwip/dns.h"
#include "lwip/mem.h"
#include "lwip/altcp_tcp.h"
#include "lwip/altcp_tls.h"
#include <string.h>
#include <stdlib.h>

Data Structures

struct  smtp_session
 

Macros

#define SMTP_POLL_INTERVAL   4
 
#define SMTP_TIMEOUT_DATABLOCK   ( 3 * 60 * SMTP_POLL_INTERVAL / 2)
 
#define SMTP_TIMEOUT_DATATERM   (10 * 60 * SMTP_POLL_INTERVAL / 2)
 
#define SMTP_TIMEOUT   ( 2 * 60 * SMTP_POLL_INTERVAL / 2)
 

Enumerations

enum  smtp_session_state
 

Functions

err_t smtp_set_server_addr (const char *server)
 
void smtp_set_server_port (u16_t port)
 
void smtp_set_tls_config (struct altcp_tls_config *tls_config)
 
err_t smtp_set_auth (const char *username, const char *pass)
 
err_t smtp_send_mail (const char *from, const char *to, const char *subject, const char *body, smtp_result_fn callback_fn, void *callback_arg)
 
err_t smtp_send_mail_static (const char *from, const char *to, const char *subject, const char *body, smtp_result_fn callback_fn, void *callback_arg)
 
void smtp_send_mail_int (void *arg)
 

Detailed Description

SMTP client module

Author: Simon Goldschmidt

Macro Definition Documentation

◆ SMTP_POLL_INTERVAL

#define SMTP_POLL_INTERVAL   4

TCP poll interval. Unit is 0.5 sec.

◆ SMTP_TIMEOUT

#define SMTP_TIMEOUT   ( 2 * 60 * SMTP_POLL_INTERVAL / 2)

TCP poll timeout while not sending the body. This is somewhat lower than the RFC states (5 minutes for initial, MAIL and RCPT) but still OK for us here. 2 minutes

◆ SMTP_TIMEOUT_DATABLOCK

#define SMTP_TIMEOUT_DATABLOCK   ( 3 * 60 * SMTP_POLL_INTERVAL / 2)

TCP poll timeout while sending message body, reset after every successful write. 3 minutes

◆ SMTP_TIMEOUT_DATATERM

#define SMTP_TIMEOUT_DATATERM   (10 * 60 * SMTP_POLL_INTERVAL / 2)

TCP poll timeout while waiting for confirmation after sending the body. 10 minutes

Enumeration Type Documentation

◆ smtp_session_state

State for SMTP client state machine