21#ifndef G_SMTP_CLIENT_H
22#define G_SMTP_CLIENT_H
48 class ClientProtocol ;
72 bool secure_tunnel {
false} ;
73 std::string sasl_client_config ;
74 bool fail_if_no_remote_recipients {
true} ;
75 bool log_msgid {
false} ;
80 Config & set_secure_tunnel(
bool =
true ) noexcept ;
81 Config & set_sasl_client_config(
const std::string & ) ;
82 Config & set_fail_if_no_remote_recipients(
bool =
true ) noexcept ;
83 Config & set_log_msgid(
bool =
true ) noexcept ;
89 std::string response ;
106 void sendMessage( std::unique_ptr<GStore::StoredMessage> message ) ;
127 static
std::
string eventLoggingString( const
GStore::StoredMessage * , const
Config & ) ;
131 void onConnect() override ;
132 bool onReceive( const
char * ,
std::
size_t ,
std::
size_t ,
std::
size_t ,
char ) override ;
133 void onDelete( const
std::
string & ) override ;
134 void onSendComplete() override ;
135 void onSecure( const
std::
string & , const
std::
string & , const
std::
string & ) override ;
136 bool protocolSend(
std::string_view ,
std::
size_t ,
bool ) override ;
137 std::string_view eventLoggingString() const noexcept override ;
146 GNet::EventState m_es ;
147 std::shared_ptr<
GStore::StoredMessage> message() ;
150 void filterDone(
int ) ;
153 void messageFail(
int = 0 , const
std::
string & = {} ) ;
154 void messageDestroy() ;
155 void onNoFilterTimeout() ;
161 std::shared_ptr<GStore::StoredMessage> m_message ;
162 std::unique_ptr<Filter> m_filter ;
165 bool m_secure {
false} ;
166 bool m_filter_special {
false} ;
168 std::string m_event_logging_string ;
171inline GSmtp::Client::Config & GSmtp::Client::Config::set_client_protocol_config(
const ClientProtocol::Config & c ) { client_protocol_config = c ;
return *this ; }
173inline GSmtp::Client::Config & GSmtp::Client::Config::set_filter_spec(
const FilterFactoryBase::Spec & r ) { filter_spec = r ;
return *this ; }
174inline GSmtp::Client::Config & GSmtp::Client::Config::set_filter_config(
const Filter::Config & c ) { filter_config = c ;
return *this ; }
175inline GSmtp::Client::Config & GSmtp::Client::Config::set_secure_tunnel(
bool b )
noexcept { secure_tunnel = b ;
return *this ; }
176inline GSmtp::Client::Config & GSmtp::Client::Config::set_sasl_client_config(
const std::string & s ) { sasl_client_config = s ;
return *this ; }
177inline GSmtp::Client::Config & GSmtp::Client::Config::set_fail_if_no_remote_recipients(
bool b )
noexcept { fail_if_no_remote_recipients = b ;
return *this ; }
178inline GSmtp::Client::Config & GSmtp::Client::Config::set_log_msgid(
bool b )
noexcept { log_msgid = b ;
return *this ; }
An interface used by GAuth::SaslClient to obtain a client id and its authentication secret.
A class for making an outgoing connection to a remote server, with support for socket-level protocols...
An interface for GNet classes that define a logging context string.
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
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() override
Destructor.
Client(GNet::EventState, FilterFactoryBase &, const GNet::Location &remote, const GAuth::SaslClientSecrets &, const Config &config)
Constructor.
A factory interface for making GSmtp::Filter message processors.
A linked list of CallFrame pointers.
A structure containing GNet::Client configuration parameters.
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.