GSmtp::Client Class Reference

A class which acts as an SMTP client, extracting messages from a message store and forwarding them to a remote SMTP server. More...

#include <gsmtpclient.h>

Inheritance diagram for GSmtp::Client:

GNet::Client GSmtp::ClientProtocol::Sender GNet::HeapClient GNet::SimpleClient GNet::EventHandler GNet::Connection GNet::SocketProtocolSink

List of all members.

Public Member Functions

 Client (const GNet::ResolverInfo &remote, const Secrets &secrets, Config config)
 Constructor.
void sendMessages (MessageStore &store)
 Sends all messages from the given message store once connected and deletes itself when done.
void sendMessage (std::auto_ptr< StoredMessage > message)
 Starts sending the given message.
G::Signal1< std::string > & messageDoneSignal ()
 Returns a signal that indicates that sendMessage() has completed or failed.

Protected Member Functions

virtual ~Client ()
 Destructor.
virtual void onConnect ()
 Final override from GNet::SimpleClient.
virtual bool onReceive (const std::string &)
 Final override from GNet::Client.
virtual void onDelete (const std::string &, bool)
 Final override from GNet::HeapClient.
virtual void onSendComplete ()
 Final override from GNet::BufferedClient.
virtual void onSecure ()
 Final override from GNet::SocketProtocol.

Classes

struct  Config
 A structure containing GSmtp::Client configuration parameters. More...


Detailed Description

A class which acts as an SMTP client, extracting messages from a message store and forwarding them to a remote SMTP server.

Definition at line 55 of file gsmtpclient.h.


Constructor & Destructor Documentation

GSmtp::Client::Client ( const GNet::ResolverInfo remote,
const Secrets secrets,
Config  config 
)

Constructor.

Starts connecting immediately.

All Client instances must be on the heap since they delete themselves after raising the done signal.

Definition at line 42 of file gsmtpclient.cpp.

References G::Signal0::connect(), G::Signal2< P1, P2 >::connect(), GSmtp::ClientProtocol::doneSignal(), GSmtp::ClientProtocol::preprocessorSignal(), and G::slot().

GSmtp::Client::~Client (  )  [protected, virtual]


Member Function Documentation

void GSmtp::Client::sendMessages ( MessageStore store  ) 

Sends all messages from the given message store once connected and deletes itself when done.

This must be used immediately after construction with a non-empty message store.

The base class doneSignal() can be used as an indication that all messages have been sent and the object has deleted itself.

Definition at line 65 of file gsmtpclient.cpp.

References GNet::SimpleClient::connected(), GSmtp::MessageStore::empty(), and G_ASSERT.

void GSmtp::Client::sendMessage ( std::auto_ptr< StoredMessage message  ) 

Starts sending the given message.

Cannot be called if there is a message already in the pipeline.

The messageDoneSignal() is used to indicate that the message processing has finished or failed.

The message is fail()ed if it cannot be sent. If this Client object is deleted before the message is sent the message is neither fail()ed or destroy()ed.

Definition at line 72 of file gsmtpclient.cpp.

References GNet::SimpleClient::connected(), and G_ASSERT.

G::Signal1< std::string > & GSmtp::Client::messageDoneSignal (  ) 

Returns a signal that indicates that sendMessage() has completed or failed.

Definition at line 60 of file gsmtpclient.cpp.

void GSmtp::Client::onConnect (  )  [protected, virtual]

Final override from GNet::SimpleClient.

Implements GNet::SimpleClient.

Definition at line 114 of file gsmtpclient.cpp.

References GNet::HeapClient::doDelete(), G_ASSERT, G_DEBUG, and GSmtp::MessageStore::iterator().

bool GSmtp::Client::onReceive ( const std::string &  line  )  [protected, virtual]

Final override from GNet::Client.

Implements GNet::Client.

Definition at line 213 of file gsmtpclient.cpp.

References GSmtp::ClientProtocol::apply(), G_DEBUG, and G::Str::printable().

void GSmtp::Client::onDelete ( const std::string &  error,
bool   
) [protected, virtual]

Final override from GNet::HeapClient.

Implements GNet::HeapClient.

Definition at line 220 of file gsmtpclient.cpp.

References G_DEBUG, and G_LOG.

void GSmtp::Client::onSendComplete (  )  [protected, virtual]

Final override from GNet::BufferedClient.

Implements GNet::SimpleClient.

Definition at line 231 of file gsmtpclient.cpp.

References GSmtp::ClientProtocol::sendDone().

void GSmtp::Client::onSecure (  )  [protected, virtual]


The documentation for this class was generated from the following files:

Generated on Fri Apr 18 15:56:14 2008 for E-MailRelay by  doxygen 1.5.5