Allocate a new mail message. Accepts an encoding to be used for Q-encoding message headers, or NULL if headers will not be in binary. Returns NULL on allocation failure or the object on success.
Add a line of body text. If the encoding is 7bit, this cannot be more than 998 characters long (returning MMBODY_BODYLINESIZ), nor can it be binary (returning MMAIL_BODYBIN). Otherwise, returns MMAIL_MALLOC on allocation failure or MMAIL_OK on success.
Add a message header. This function should be called before mmail_addbody
(), since mail encodings are determined by existing header data. Returns MMAIL_HEADMAX if the header type limit has been exceeded, MMAIL_HEADBODTOK if a binary header has been specified without an encoding (see mmail_alloc
()), MMAIL_MALLOC on allocation failure, per-header-type errors on header validation failure, or MMAIL_OK on success.
Completely clone a mail and its components. Returns NULL on allocation failure or the object on success.
Convert an error code into a English-language equivalent, which is formatted with a leading capital letter and no ending punctuation.
Completely free a mail message's memory.
Remove the components of a mail message, readying it for re-use in a parse or manual add.
Normalise an e-mail and write it. If an encoding is specified, headers are Q-encoded with quoted-printable. If a transfer encoding is specified in a MIME message, the body is appropriate transcoded. Long lines (with quoted-printable transfer encoding) are soft line-broken. Returns 0 on underlying output stream failure, 1 on success.
Clone a body line. Returns NULL on allocation failure or the object on success.
Unlink a body line from its mail context and free its memory.
Get the first body line of a mail message. Returns NULL if no body lines are present or the object on success.
Returns a subsequent line within a mail body or NULL if this is the last.
Clone a header line. Returns NULL on allocation failure or the object on success.
Unlink a message header from its mail context and free its memory. Be careful calling this on important headers as existing message flags (such as transfer encodings) may be retained.
Find the first instance of a message header. Returns the header or NULL if none exists.
Proceed to the next header of the same type. Returns the header or NULL if none exists.
Proceed to the next header in a message. Returns the header or NULL if none exists.
Allocate a parse routine with a given encoding (which is passed along to all generated messages), error message function, warning message function, and private data. Returns NULL on allocation failure or the object on success.
Parse a single line of input into a mail message. Returns 0 on failure, 1 on success (errors/warnings will be reported via the provided callback functions).
Current line column of a parsing sequence.
Detach a mail message from the parsing context. The detached message must be freed manually. Returns NULL if no message exists (has already been detached) or the object on success.
End a parsing sequence. Returns 0 on failure, 1 on success (errors/warnings will be reported via the provided callback functions).
Free a parsing sequence and, if it has not been detached with mmp_detach
(), any contained in-parse message.
Current line number of a parsing sequence.
Get a pointer to the currently-parsed mail message. Returns NULL if no message exists (has been detached) or the object on success.
Reset a parse sequence. Calls through to mmail_reset
() if the in-parse message has not been detached, else a new message is allocated. Returns 0 if memory allocation fails (in the event that the prior message has been detached), 1 on success.