RFC 4954

Auth Extension

When enabled and the SMTP server advertises the AUTH extension, libESMTP will attempt to authenticate to the SMTP server before transferring any messages.

Authentication Contexts

A separate authentication context must be created for each SMTP session. The application is responsible for destroying context. The application should either call smtp_destroy_session() or call smtp_auth_set_context() with context set to NULL before doing so. The authentication API is described separately.

int smtp_auth_set_context(smtp_session_t session, auth_context_t context)

Set authentication context.


smtp_session_t session

The session.

auth_context_t context

The auth context.


Enable the SMTP AUTH verb if context is not NULL or disable it when context is NULL. context must be obtained from the SASL (RFC 4422) client library API defined in auth-client.h.


Non zero on success, zero on failure.