type

SmtpClient

src class SmtpClient : Obj

SmtpClient implements the client side of SMTP (Simple Mail Transport Protocol) as specified by RFC 2821.

See pod doc and examples.

fields

host

DNS hostname of server.

password

Password to use for authentication, or null to skip authentication.

port

TCP port number of server, defaults to 25.

socketConfig

The SocketConfig to use for creating sockets.

ssl

Open connection using SSL/TLS (ensure port is configured properly).

username

Username to use for authentication, or null to skip authentication.

methods

authCramMd5

Authenticate using CRAM-MD5 mechanism.

authLogin

Authenticate using LOGIN mechanism.

authPlain

Authenticate using PLAIN mechanism.

authenticate

Authenticate using the strongest mechanism which both the server and myself support.

close

Close the session to the SMTP server.

isClosed

Return true if there is no open session.

open

Open a session to the SMTP server.

send

Send the email to the SMTP server.

Slot Details

authCramMd5

src Void authCramMd5()

Authenticate using CRAM-MD5 mechanism.

authLogin

src Void authLogin()

Authenticate using LOGIN mechanism.

authPlain

src Void authPlain()

Authenticate using PLAIN mechanism.

authenticate

src Void authenticate()

Authenticate using the strongest mechanism which both the server and myself support.

close

src Void close()

Close the session to the SMTP server. Do nothing if session already closed.

host

src Str? host

DNS hostname of server.

isClosed

src Bool isClosed()

Return true if there is no open session.

open

src 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.

password

src Str? password

Password to use for authentication, or null to skip authentication.

port

src Int port := 25

TCP port number of server, defaults to 25.

send

src Void send(Email email)

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.

socketConfig

src SocketConfig socketConfig := SocketConfig.cur

The SocketConfig to use for creating sockets.

ssl

src Bool ssl

Open connection using SSL/TLS (ensure port is configured properly). If false then the connection is opened plaintext, but may still be upgraded to TLS if server specifies STARTTLS.

username

src Str? username

Username to use for authentication, or null to skip authentication.