Skip to main content

Module smtp

Module smtp 

Source
Expand description

SMTP (Simple Mail Transfer Protocol) layer implementation.

Implements RFC 5321 SMTP and RFC 1869 ESMTP packet parsing as a zero-copy view into a packet buffer.

§Protocol Overview

SMTP is a text-based protocol operating over TCP. Standard ports:

  • 25: MTA-to-MTA relay
  • 587: Client submission (RFC 6409)
  • 465: SMTPS (deprecated, but still widely used)

§Packet Format

Client Command:

VERB [parameters]\r\n

Server Reply:

NNN<SP>text\r\n              (single-line)
NNN-text\r\n ... NNN<SP>text\r\n  (multi-line)

§SMTP Commands (RFC 5321 §4.1)

CommandDescription
EHLOExtended HELLO (ESMTP)
HELOHELLO
MAILBegin mail transaction (FROM)
RCPTIdentify recipient (TO)
DATABegin message data
RSETReset transaction
VRFYVerify address
EXPNExpand mailing list
HELPHelp information
NOOPNo operation
QUITTerminate connection
AUTHAuthenticate (RFC 4954)
STARTTLSStart TLS negotiation (RFC 3207)

Re-exports§

pub use builder::SmtpBuilder;

Modules§

builder
SMTP packet builder.

Structs§

SmtpLayer
A zero-copy view into an SMTP layer within a packet buffer.

Constants§

CMD_AUTH
CMD_BDAT
CMD_DATA
CMD_EHLO
CMD_EXPN
CMD_HELO
CMD_HELP
CMD_MAIL
CMD_NOOP
CMD_QUIT
CMD_RCPT
CMD_RSET
CMD_STARTTLS
CMD_VRFY
REPLY_ARG_SYNTAX_ERROR
REPLY_AUTH_FAILED
REPLY_AUTH_INPUT
REPLY_AUTH_REQUIRED
REPLY_AUTH_SUCCESS
REPLY_BAD_CMD_SEQUENCE
REPLY_CANNOT_VRFY
REPLY_CLOSING
REPLY_CMD_NOT_IMPL
REPLY_CMD_NOT_IMPL_PARAM
REPLY_CMD_UNRECOGNIZED
REPLY_DATA_INPUT
REPLY_EXCEED_STORAGE
REPLY_HELP
REPLY_INSUFF_STORAGE
REPLY_LOCAL_ERROR
REPLY_MAILBOX_NAME_INVALID
REPLY_MAILBOX_UNAVAIL
REPLY_MAILBOX_UNAVAIL_PERM
REPLY_OK
REPLY_SERVICE_READY
REPLY_SERVICE_UNAVAIL
REPLY_SYSTEM_STATUS
REPLY_TEMP_AUTH_FAIL
REPLY_TRANSACTION_FAILED
REPLY_USER_NOT_LOCAL
REPLY_USER_NOT_LOCAL_PERM
SMTPS_PORT
SMTPS (over TLS) port.
SMTP_MIN_HEADER_LEN
Minimum SMTP payload size.
SMTP_PORT
SMTP standard relay port.
SMTP_SUBMISSION_PORT
SMTP submission port (RFC 6409).

Statics§

SMTP_COMMANDS
SMTP_FIELD_NAMES
Field names for Python/generic access.

Functions§

is_smtp_payload
Returns true if buf looks like an SMTP control-connection payload.
reply_code_description
Returns a description for an SMTP reply code.
smtp_show_fields
Returns a human-readable display of SMTP layer fields.