Documentation

Documentation

Includes

lwip/apps/smtp_opts.h

#include "lwip/apps/smtp_opts.h"
#include "lwip/apps/smtp_opts.h"

lwip/err.h

#include "lwip/err.h"
#include "lwip/err.h"

lwip/prot/iana.h

#include "lwip/prot/iana.h"
#include "lwip/prot/iana.h"

Macros

Marco LWIP_HDR_APPS_SMTP_H

#define LWIP_HDR_APPS_SMTP_H


      

Marco SMTP_DEFAULT_PORT

#define SMTP_DEFAULT_PORT        LWIP_IANA_PORT_SMTP
/** The default TCP port used for SMTP */

Marco SMTPS_DEFAULT_PORT

#define SMTPS_DEFAULT_PORT       LWIP_IANA_PORT_SMTPS
/** The default TCP port used for SMTPS */

Marco SMTP_RESULT_OK

#define SMTP_RESULT_OK           0
/** Email successfully sent */

Marco SMTP_RESULT_ERR_UNKNOWN

#define SMTP_RESULT_ERR_UNKNOWN  1
/** Unknown error */

Marco SMTP_RESULT_ERR_CONNECT

#define SMTP_RESULT_ERR_CONNECT  2
/** Connection to server failed */

Marco SMTP_RESULT_ERR_HOSTNAME

#define SMTP_RESULT_ERR_HOSTNAME 3
/** Failed to resolve server hostname */

Marco SMTP_RESULT_ERR_CLOSED

#define SMTP_RESULT_ERR_CLOSED   4
/** Connection unexpectedly closed by remote server */

Marco SMTP_RESULT_ERR_TIMEOUT

#define SMTP_RESULT_ERR_TIMEOUT  5
/** Connection timed out (server didn't respond in time) */

Marco SMTP_RESULT_ERR_SVR_RESP

#define SMTP_RESULT_ERR_SVR_RESP 6
/** Server responded with an unknown response code */

Marco SMTP_RESULT_ERR_MEM

#define SMTP_RESULT_ERR_MEM      7
/** Out of resources locally */

Marco SMTP_BODYDH_BUFFER_SIZE

#define SMTP_BODYDH_BUFFER_SIZE 256

      

Functions

Func smtp_send_mail_bodycback

err_t smtp_send_mail_bodycback(const char *from, const char* to, const char* subject,
                    smtp_bodycback_fn bodycback_fn, smtp_result_fn callback_fn, void* callback_arg);


      

Func smtp_set_server_addr

err_t smtp_set_server_addr(const char* server);


      

Func smtp_set_server_port

void smtp_set_server_port(u16_t port);


      

Func smtp_set_tls_config

void smtp_set_tls_config(struct altcp_tls_config *tls_config);


      

Func smtp_set_auth

err_t smtp_set_auth(const char* username, const char* pass);


      

Func smtp_send_mail

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);


      

Func smtp_send_mail_static

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);


      

Func smtp_send_mail_int

void smtp_send_mail_int(void *arg);

      

Vars

Variable altcp_tls_config

struct altcp_tls_config;

      

Consts

Const

const char* smtp_result_str(u8_t smtp_result);

      

Types

Typedefs

Typedef smtp_result_fn

typedef void (*smtp_result_fn)(void *arg, u8_t smtp_result, u16_t srv_err, err_t err);
/** Prototype of an smtp callback function
 *
 * @param arg argument specified when initiating the email
 * @param smtp_result result of the mail transfer (see defines SMTP_RESULT_*)
 * @param srv_err if aborted by the server, this contains the error code received
 * @param err an error returned by internal lwip functions, can help to specify
 *            the source of the error but must not necessarily be != ERR_OK
 */

Typedef smtp_bodycback_fn

typedef int (*smtp_bodycback_fn)(void *arg, struct smtp_bodydh *bodydh);
/** Prototype of an smtp body callback function
 * It receives a struct smtp_bodydh, and a buffer to write data,
 * must return BDH_WORKING to be called again and BDH_DONE when
 * it has finished processing. This one tries to fill one TCP buffer with
 * data, your function will be repeatedly called until that happens; so if you
 * know you'll be taking too long to serve your request, pause once in a while
 * by writing length=0 to avoid hogging system resources
 *
 * @param arg argument specified when initiating the email
 * @param smtp_bodydh state handling + buffer structure
 */