#define TLS_NO 0
#define TLS_YES 1
#define TLS_FORCE 2
#define TLS_SMTPS 3
#define CERT_OK 0
#define CERT_UNKNOWN 1
#define CERT_INVALID 2
#define FAIL_INTERNAL 1
#define FAIL_CONN 2
#define FAIL_PROTO 3
#define FAIL_IMPL 4
#define FAIL_RESP 5
struct smtp_params {
size_t linemax;
size_t ibufmax;
size_t obufmax;
const struct sockaddr *dst;
const struct sockaddr *src;
int timeout;
int tls_req;
int tls_verify;
const char *tls_servname;
int lmtp;
const char *helo;
const char *auth_user;
const char *auth_pass;
};
struct smtp_rcpt {
const char *to;
const char *dsn_notify;
const char *dsn_orcpt;
int done;
};
struct smtp_mail {
const char *from;
const char *dsn_ret;
const char *dsn_envid;
struct smtp_rcpt *rcpt;
int rcptcount;
FILE *fp;
};
struct smtp_status {
struct smtp_rcpt *rcpt;
const char *cmd;
const char *status;
};
struct smtp_client;
struct smtp_client *smtp_connect(const struct smtp_params *, void *);
void smtp_cert_verified(struct smtp_client *, int);
void smtp_set_tls(struct smtp_client *, void *);
void smtp_quit(struct smtp_client *);
void smtp_sendmail(struct smtp_client *, struct smtp_mail *);
void smtp_require_tls(void *, struct smtp_client *);
void smtp_ready(void *, struct smtp_client *);
void smtp_failed(void *, struct smtp_client *, int, const char *);
void smtp_closed(void *, struct smtp_client *);
void smtp_status(void *, struct smtp_client *, struct smtp_status *);
void smtp_done(void *, struct smtp_client *, struct smtp_mail *);