Karta. SMTP. Client. Stuff
(Karta v1.0.0)
Dot-stuffing (RFC 5321 ยง4.5.2) of a message sent in pieces, with the check for bare line endings over the same bytes.
new/0 starts, feed/2 takes the message's next bytes โ in pieces of any
size, with a line ending, a leading dot or the CRLF before it split
across two pieces โ and gives back what to send, and finish/1 gives the
end: a CRLF when the message does not end with one, then the final
"." CRLF. whole/1 does all three for a message held in memory.
The bytes are the same for any division of a message: the message with a
CRLF at the end, every . that starts a line doubled, and the final
dot. A bare CR or LF is {:error, :bare_line_ending}: some servers end a
message on <LF>.<LF>, which would let message text be read as commands
(SMTP smuggling).
Summary
Functions
Takes the message's next bytes and gives back what to send.
The end of the message: the last bytes, the final CRLF if one is missing, and the dot.
A stuffing in progress.
The stuffed message, which is one message and not a stream of them.
Types
Functions
Takes the message's next bytes and gives back what to send.
The end of the message: the last bytes, the final CRLF if one is missing, and the dot.
@spec new() :: t()
A stuffing in progress.
The stuffed message, which is one message and not a stream of them.