Repository navigation
Adds SendContext, which bounds the whole SMTP transaction with a context. Send keeps its signature and its previous behaviour.
Fixes:
- Header injection through a caller-supplied subject, address or attachment file name. CR and LF are rejected before the message is built, and file names go through
mime.FormatMediaType, so an ordinary name is no longer quoted and a non-ASCII name is encoded per RFC 2231. - SMTP delivery failures reported at DATA close were discarded, so a rejected message looked delivered.
- Base64 attachment lines were not wrapped to the MIME limit, which some servers reject. Empty attachment files are now accepted instead of returning an error.