21#ifndef G_SMTP_CLIENT_H
22#define G_SMTP_CLIENT_H
46 class ClientProtocol ;
58 std::string filter_address ;
59 unsigned int filter_timeout{0U} ;
60 bool bind_local_address{
false} ;
63 unsigned int connection_timeout{0U} ;
64 unsigned int secure_connection_timeout{0U} ;
65 bool secure_tunnel{
false} ;
66 std::string sasl_client_config ;
69 Config(
const std::string & filter_address ,
unsigned int filter_timeout ,
70 bool bind_local_address ,
const GNet::Address & local_address ,
72 unsigned int connection_timeout ,
unsigned int secure_connection_timeout ,
73 bool secure_tunnel ,
const std::string & sasl_client_config ) ;
75 Config & set_filter_address(
const std::string & ) ;
76 Config & set_filter_timeout(
unsigned int ) ;
77 Config & set_bind_local_address(
bool =
true ) ;
80 Config & set_connection_timeout(
unsigned int ) ;
81 Config & set_secure_connection_timeout(
unsigned int ) ;
82 Config & set_secure_tunnel(
bool =
true ) ;
83 Config & set_sasl_client_config(
const std::string & ) ;
108 void sendMessage( std::unique_ptr<StoredMessage> message ) ;
126 void onConnect()
override ;
127 bool onReceive(
const char * , std::size_t , std::size_t , std::size_t ,
char )
override ;
128 void onDelete(
const std::string & )
override ;
129 void onSendComplete()
override ;
130 void onSecure(
const std::string & ,
const std::string & ,
const std::string & )
override ;
131 bool protocolSend(
const std::string & , std::size_t ,
bool )
override ;
136 void operator=(
const Client & ) = delete ;
137 void operator=(
Client && ) = delete ;
140 std::shared_ptr<StoredMessage> message() ;
141 void protocolDone(
int ,
const std::string & ,
const std::string & ,
const G::StringArray & ) ;
143 void filterDone(
int ) ;
146 void messageFail(
int = 0 ,
const std::string & = std::string() ) ;
147 void messageDestroy() ;
148 void startSending() ;
149 void quitAndFinish() ;
155 std::unique_ptr<Filter> m_filter ;
156 std::shared_ptr<StoredMessage> m_message ;
157 std::shared_ptr<MessageStore::Iterator> m_iter ;
159 bool m_secure_tunnel ;
161 unsigned int m_message_count ;
164inline GSmtp::Client::Config & GSmtp::Client::Config::set_filter_address(
const std::string & s ) { filter_address = s ;
return *this ; }
165inline GSmtp::Client::Config & GSmtp::Client::Config::set_filter_timeout(
unsigned int t ) { filter_timeout = t ;
return *this ; }
166inline GSmtp::Client::Config & GSmtp::Client::Config::set_bind_local_address(
bool b ) { bind_local_address = b ;
return *this ; }
168inline GSmtp::Client::Config & GSmtp::Client::Config::set_client_protocol_config(
const ClientProtocol::Config & c ) { client_protocol_config = c ;
return *this ; }
169inline GSmtp::Client::Config & GSmtp::Client::Config::set_connection_timeout(
unsigned int t ) { connection_timeout = t ;
return *this ; }
170inline GSmtp::Client::Config & GSmtp::Client::Config::set_secure_connection_timeout(
unsigned int t ) { secure_connection_timeout = t ;
return *this ; }
171inline GSmtp::Client::Config & GSmtp::Client::Config::set_secure_tunnel(
bool b ) { secure_tunnel = b ;
return *this ; }
172inline GSmtp::Client::Config & GSmtp::Client::Config::set_sasl_client_config(
const std::string & s ) { sasl_client_config = s ;
return *this ; }
An interface used by GAuth::SaslClient to obtain a client id and its authentication secret.
The GNet::Address class encapsulates a TCP/UDP transport address.
A class for making an outgoing connection to a remote server, with support for socket-level protocols...
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
A class that represents the remote target for out-going client connections.
An interface used by ClientProtocol to send protocol messages.
Implements the client-side SMTP protocol.
A class which acts as an SMTP client, extracting messages from a message store and forwarding them to...
void sendMessage(std::unique_ptr< StoredMessage > message)
Starts sending the given message.
void sendMessagesFrom(MessageStore &store)
Sends all messages from the given message store once connected.
~Client() override
Destructor.
Client(GNet::ExceptionSink, FilterFactory &, const GNet::Location &remote, const GAuth::SaslClientSecrets &client_secrets, const Config &config)
Constructor.
G::Slot::Signal< const std::string & > & messageDoneSignal()
Returns a signal that indicates that sendMessage() has completed or failed.
A factory interface for GSmtp::Filter message processors.
A class which allows SMTP messages to be stored and retrieved.
A linked list of CallFrame pointers.
SMTP and message-store classes.
std::vector< std::string > StringArray
A std::vector of std::strings.
A structure containing GNet::Client configuration parameters.
A structure containing GSmtp::ClientProtocol configuration parameters.
A structure containing GSmtp::Client configuration parameters.