SmtpClient implements the client side of SMTP (Simple Mail Transport Protocol) as specified by RFC 2821.
See docLib for details. See docCookbook for coding examples.
Slots
- authCramMd5Source
-
Void authCramMd5()Authenticate using CRAM-MD5 mechanism.
- authLoginSource
-
Void authLogin()Authenticate using LOGIN mechanism.
- authPlainSource
-
Void authPlain()Authenticate using PLAIN mechanism.
- authenticateSource
-
Void authenticate()Authenticate using the strongest mechanism which both the server and myself support.
-
private Str[]? auths - closeSource
-
Void close()Close the session to the SMTP server. Do nothing if session already closed.
- hostSource
-
Str hostDNS hostname of server.
- isClosedSource
-
Bool isClosed()Return true if there is no open session.
- logSource
-
Log log := Log.get("smtp")Log for tracing
- openSource
-
Void open()Open a session to the SMTP server. If username and password are configured, then SMTP authentication is attempted. Throw SmtpErr if there is a protocol error. Throw IOErr is there is a network problem.
- passwordSource
-
Str? passwordPassword to use for authentication, or null to skip authentication.
- portSource
-
Int port := 25TCP port number of server, defaults to 25.
- readExtsSource
-
Query the reply lines to figure out which extensions the server supports that we might use.
-
private SmtpRes readRes()Read a single or multi-line reply from the server.
- sendSource
-
Send the email to the SMTP server. Throw SmtpErr if there is a protocol error. Throw IOErr if there is a networking problem. If the session is closed, then this call automatically opens the session and guarantees a close after it is complete.
-
private TcpSocket? sock - usernameSource
-
Str? usernameUsername to use for authentication, or null to skip authentication.
-
private Void writeReq(Str req)Write a request line to the server.