Alumna::SMTP::Session
One SMTP dialog on one connection (RFC 5321, RFC 3207 STARTTLS, RFC 4954 AUTH).
greeting (220), EHLO (250), [STARTTLS (220), TLS, EHLO (250)], [AUTH (235)], MAIL FROM (250), RCPT TO (250/251) for each address, DATA (354), message + "." (250), QUIT.
The session owns the IO. It wraps it in TLS when the mode asks for it, and it closes it at the end. Each command is one write and one flush.
Result: nil when the server accepted the message (250 after the data). A reply that is not the expected code: MailError "SMTP send failed (code): text". A refused recipient: RSET, QUIT, MailError with the address. Network, TLS, and timeout errors: MailError "mail send failed". A malformed reply: MailError "SMTP server sent an invalid reply". The username and the password are replaced with [redacted] in error text.
EHLO only (no HELO fallback). The message needs no dot-stuffing: Message.write never starts a line with ".".
Constants
A reply line longer than this is invalid. RFC 5321 allows 512 with CRLF.
A multi-line reply with more lines is invalid. It stops an endless reply.
Constructors
Class methods
Checks the envelope before a connection opens. The address of from and of each recipient must be printable ASCII with no space, "<", or ">". A non-ASCII address needs SMTPUTF8, which this shard does not support.
Instance methods
Runs the full dialog for one mail. Call it once. The IO is closed after it.