Streaming encoder for SMTP DATA content, the inverse of
Sovite.SMTP.DataDecoder.
It dot-stuffs the message (RFC 5321 §4.5.2) as chunks are fed in, and
finish/1 returns the terminating <CRLF>.<CRLF>, adding a CRLF first
if the message does not end with one.
encoder = DataEncoder.new()
{data, encoder} = DataEncoder.encode(encoder, "Subject: hi\r\n\r\n.dot\r\n")
IO.iodata_to_binary([data, DataEncoder.finish(encoder)])
#=> "Subject: hi\r\n\r\n..dot\r\n.\r\n"The message must use CRLF line endings, as Sovite.Queue.Spool stores
it. A dot is stuffed after every LF, so a bare LF can never produce a
line that ends the data early.
Summary
Functions
Encodes the next chunk of the message.
Returns the end-of-data sequence.
Returns an encoder for the start of a message.