smtp

SMTP Protocol Helpers

Functions

FunctionDescription
_smtp_byte_atInternal byte reader.
_smtp_copyInternal: copy bytes from src to dst+doff.
_smtp_crlfInternal: write CRLF at position.
smtp_format_ehloFormat EHLO command: “EHLO domain\r\n”
smtp_format_mail_fromFormat MAIL FROM command: “MAIL FROM:\r\n”
smtp_format_rcpt_toFormat RCPT TO command: “RCPT TO:\r\n”
smtp_format_dataFormat DATA command: “DATA\r\n”
smtp_parse_replyParse SMTP reply code from buffer. Returns integer code (e.g. 250). Expects f…
smtp_reply_is_okCheck if reply code is success (2xx).

Details

_smtp_byte_at

fn _smtp_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_smtp_copy

fn _smtp_copy(dst: &i8, doff: i64, src: &i8, soff: i64, n: i64) -> i64

Internal: copy bytes from src to dst+doff.

_smtp_crlf

fn _smtp_crlf(out: &i8, pos: i64) -> i64

Internal: write CRLF at position.

smtp_format_ehlo

fn smtp_format_ehlo(domain: &i8, dlen: i64, out: &i8) -> i64

Format EHLO command: “EHLO domain\r\n”

smtp_format_mail_from

fn smtp_format_mail_from(addr: &i8, alen: i64, out: &i8) -> i64

Format MAIL FROM command: “MAIL FROM:\r\n”

smtp_format_rcpt_to

fn smtp_format_rcpt_to(addr: &i8, alen: i64, out: &i8) -> i64

Format RCPT TO command: “RCPT TO:\r\n”

smtp_format_data

fn smtp_format_data(out: &i8) -> i64

Format DATA command: “DATA\r\n”

smtp_parse_reply

fn smtp_parse_reply(buf: &i8, len: i64) -> i64

Parse SMTP reply code from buffer. Returns integer code (e.g. 250). Expects first 3 bytes to be ASCII digits.

smtp_reply_is_ok

fn smtp_reply_is_ok(code: i64) -> i64

Check if reply code is success (2xx).