21#ifndef G_SMTP_CLIENT_H
22#define G_SMTP_CLIENT_H
47 class ClientProtocol ;
71 bool bind_local_address {
false} ;
73 unsigned int connection_timeout {0U} ;
74 unsigned int secure_connection_timeout {0U} ;
75 bool secure_tunnel {
false} ;
76 std::string sasl_client_config ;
77 std::string client_tls_profile ;
78 bool fail_if_no_remote_recipients {
true} ;
85 Config & set_bind_local_address(
bool =
true ) noexcept ;
87 Config & set_connection_timeout(
unsigned int ) noexcept ;
88 Config & set_secure_connection_timeout(
unsigned int ) noexcept ;
89 Config & set_secure_tunnel(
bool =
true ) noexcept ;
90 Config & set_sasl_client_config(
const std::string & ) ;
91 Config & set_client_tls_profile(
const std::string & ) ;
92 Config & set_fail_if_no_remote_recipients(
bool =
true ) noexcept ;
98 std::string response ;
115 void sendMessage( std::unique_ptr<GStore::StoredMessage> message ) ;
137 void onConnect() override ;
138 bool onReceive( const
char * ,
std::
size_t ,
std::
size_t ,
std::
size_t ,
char ) override ;
139 void onDelete( const
std::
string & ) override ;
140 void onSendComplete() override ;
141 void onSecure( const
std::
string & , const
std::
string & , const
std::
string & ) override ;
142 bool protocolSend(
G::string_view ,
std::
size_t ,
bool ) override ;
151 std::shared_ptr<
GStore::StoredMessage> message() ;
154 void filterDone(
int ) ;
157 void messageFail(
int = 0 , const
std::
string & = {} ) ;
158 void messageDestroy() ;
159 void onNoFilterTimeout() ;
165 std::shared_ptr<GStore::StoredMessage> m_message ;
166 std::unique_ptr<Filter> m_filter ;
170 bool m_filter_special ;
175inline GSmtp::Client::Config & GSmtp::Client::Config::set_client_protocol_config(
const ClientProtocol::Config & c ) { client_protocol_config = c ;
return *this ; }
176inline GSmtp::Client::Config & GSmtp::Client::Config::set_filter_spec(
const FilterFactoryBase::Spec & r ) { filter_spec = r ;
return *this ; }
177inline GSmtp::Client::Config & GSmtp::Client::Config::set_filter_config(
const Filter::Config & c ) { filter_config = c ;
return *this ; }
178inline GSmtp::Client::Config & GSmtp::Client::Config::set_bind_local_address(
bool b )
noexcept { bind_local_address = b ;
return *this ; }
180inline GSmtp::Client::Config & GSmtp::Client::Config::set_connection_timeout(
unsigned int t )
noexcept { connection_timeout = t ;
return *this ; }
181inline GSmtp::Client::Config & GSmtp::Client::Config::set_secure_connection_timeout(
unsigned int t )
noexcept { secure_connection_timeout = t ;
return *this ; }
182inline GSmtp::Client::Config & GSmtp::Client::Config::set_secure_tunnel(
bool b )
noexcept { secure_tunnel = b ;
return *this ; }
183inline GSmtp::Client::Config & GSmtp::Client::Config::set_sasl_client_config(
const std::string & s ) { sasl_client_config = s ;
return *this ; }
184inline GSmtp::Client::Config & GSmtp::Client::Config::set_client_tls_profile(
const std::string & s ) { client_tls_profile = s ;
return *this ; }
185inline GSmtp::Client::Config & GSmtp::Client::Config::set_fail_if_no_remote_recipients(
bool b )
noexcept { fail_if_no_remote_recipients = b ;
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.
A timer class template in which the timeout is delivered to the specified method.
An interface used by ClientProtocol to send protocol messages.
Implements the client-side SMTP protocol.
A class which acts as an SMTP client, sending messages to a remote SMTP server.
G::Slot::Signal< const MessageDoneInfo & > & messageDoneSignal() noexcept
Returns a signal that indicates that sendMessage() has completed or failed.
void quitAndFinish()
Finishes a sendMessage() sequence.
void sendMessage(std::unique_ptr< GStore::StoredMessage > message)
Starts sending the given message.
Client(GNet::ExceptionSink, FilterFactoryBase &, const GNet::Location &remote, const GAuth::SaslClientSecrets &, const Config &config)
Constructor.
~Client() override
Destructor.
A factory interface for making GSmtp::Filter message processors.
A linked list of CallFrame pointers.
A structure containing GNet::Client configuration parameters.
A configuration structure for GNet::StreamSocket.
A structure containing GSmtp::ClientProtocol configuration parameters.
A structure containing GSmtp::Client configuration parameters.
Signal parameters for GNet::Client::messageDoneSignal()
Filter specification tuple for GSmtp::FilterFactoryBase::newFilter().
Configuration passed to filter constructors.
A slot holder, with connect() and emit() methods.