Class SmtpClient.

Inherits Connection

The SmtpClient class provides an SMTP client, as the alert reader will have inferred from its name.

Archiveopteryx uses it to send outgoing messages to a smarthost.

SmtpClient::SmtpClient( const Endpoint & address )

Constructs an SMTP client which will immediately connect to address and introduce itself, and then wait politely for something to do.

static EString SmtpClient::dotted( const EString & s )

Returns a dot-escaped version of s, with a dot-cr-lf appended. This function probably should change lone CR or LF characters to CRLF, but it doesn't yet.

EString SmtpClient::error() const

Returns the client's error string, which is empty if no error has occurred.

void SmtpClient::finish( const char * status )

Finishes message sending activities, however they turned out, and notifies the user. status is used as Recipient::status() for all unhandled recipients.

void SmtpClient::handleFailure( const EString & line )

Reacts appropriately to any failure. Assumes that line is a complete SMTP reply line, including three-digit status code.

static SmtpClient * SmtpClient::idleClient()

This private helper returns a pointer to an idle SMTP client, or a null pointer if none are idle.

void SmtpClient::logout( uint t )

Sends quit after t seconds. t must not be 0.

Any subsequent use of the SmtpClient cancels the logout.

static uint SmtpClient::observedSize()

Returns the SIZE argument provided by the smarthost, or 0 if we haven't connected to the smarthost, or if the smarthost sent something shady.

void SmtpClient::parse()

Reads and reacts to SMTP/LMTP responses. Sends new commands.

static SmtpClient * SmtpClient::provide()

Provides an SMTP client.

If one is idly waiting now, provide() returns its address. If not, provide() makes one and then returns it.

bool SmtpClient::ready() const

Returns true if this SmtpClient is ready to send() mail. SmtpClient notifies its owner when it becomes ready.

void SmtpClient::recordExtension( const EString & line )

Parses line assuming it is an extension announcement, and records the extensions found. Parse errors, unknown extensions and so on are silently ignored.

void SmtpClient::send( DSN * dsn, EventHandler * user )

Starts sending the message held by dsn with the right sender and recipients. Updates the dsn and its recipients with information about which recipients fail or succeed, and how. Notifies user when it's done.

Does not use DSN::envelopeId() at present.

void SmtpClient::sendCommand()

Sends a single SMTP command.

DSN * SmtpClient::sending() const

Returns a pointer to the DSN currently being sent, or a null pointer if none.

bool SmtpClient::sent() const

Returns true if the most recent transmission attempt worked for at least one recipient, and false if not.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.