309 bool logged_in = False;
318 hash<auto> hello_reply;
320 const MaxDebugLine = 2048;
334 const SmtpsPort = 465;
337 const EsmtpPort = 587;
597 nothing
setWarningQueue(
int warning_ms,
int warning_bs, Queue queue,
auto arg, timeout min_ms = 1s);
677 final disconnectIntern();
703 sendDataIntern(data str);
709 sendData(
string str);
722 final hash<SmtpResponseInfo> sendCommand(
string str);
728 string readLine(timeout to);
740 forceDisconnectIntern();
858 bool getReply(reference<int> rcode, reference<string> rmsg);
875 "cls": Class::forName(
"SmtpConnection"),
889 constructor(
string name,
string description,
string url, hash<auto> attributes = {}, hash<auto> options = {})
974 "type":
"SmtpClientDataProvider",
975 "supports_children": True,
977 "children_can_support_apis": True,
978 "children_can_support_records": False,
979 "children_can_support_observers": False,
984 "url": <DataProviderOptionInfo>{
985 "type": AbstractDataProviderType::get(StringType),
986 "desc":
"A URL for an SMTP server",
996 "send-email": Class::forName(
"SmtpClient::SmtpClientSendEmailDataProvider"),
1054 "name":
"send-email",
1055 "desc":
"SMTP send email data provider",
1056 "type":
"SmtpClientSendEmailDataProvider",
1058 "supports_request": True,
1063 AbstractDataProvider::DataProviderSummaryInfoKeys
1125 "desc":
"The data for the attachment",
1130 "desc":
"The encoding to use for the attachment:\n"
1131 "- `default`: `quoted-printable` for string data, `base64` for binary data\n"
1132 "- `none`: no content encoding (not recommended)\n"
1133 "- `quoted-printable`: quoted printable encoding \n"
1134 "- `base64`: base64 encoding",
1135 "default_value":
"default",
1138 "type": HashOrNothingType,
1139 "desc":
"Optional headers to send with the attachment",
1143 "desc":
"The MIME type of the attachment",
1148 "desc":
"The name or filename of the attachment",
1169 "desc":
"Any attachments for the message",
1172 "type":
new SoftListDataType(StringType, True),
1173 "desc":
"One or more `Bcc:` addresses for the email",
1177 "desc":
"The message body",
1181 "desc":
"The encoding to use for the attachment:\n"
1182 "- `default`: `quoted-printable` for string data, `base64` for binary data\n"
1183 "- `none`: no content encoding (not recommended)\n"
1184 "- `quoted-printable`: quoted printable encoding \n"
1185 "- `base64`: base64 encoding",
1186 "default_value":
"default",
1189 "type": StringOrNothingType,
1190 "desc":
"The MIME type of the message body",
1193 "type":
new SoftListDataType(StringType, True),
1194 "desc":
"One or more `Cc:` addresses for the email",
1198 "desc":
"The sender address for the email",
1203 "desc":
"The subject for the email",
1206 "type":
new SoftListDataType(StringType, True),
1207 "desc":
"One or more `To:` addresses for the email",
1227 "desc":
"The return code provided by the SMTP server for the command",
1231 "desc":
"The string description returned by the server",
1257 static Class
cls =
new Class(
"SmtpClientDataProvider");
1261 "name":
"smtpclient",
1262 "desc":
"SMTP client data provider factory",
1263 "children_can_support_apis": True,
for backwards-compatibility only
Definition: SmtpClient.qm.dox.h:265
for backwards-compatibility and convenience
Definition: SmtpClient.qm.dox.h:245
constructor(string sender, string subject)
creates a Message object from the arguments given
The SMTP data provider factory.
Definition: SmtpClient.qm.dox.h:1252
hash< DataProviderFactoryInfo > getInfoImpl()
Returns static factory information without provider_info.
hash< DataProviderInfo > getProviderInfoImpl()
Returns static provider information.
static Class cls
Data provider type info.
Definition: SmtpClient.qm.dox.h:1257
Class getClassImpl()
Returns the class for the data provider object.
const FactoryInfo
Factory info.
Definition: SmtpClient.qm.dox.h:1260
Data provider implementing an API for sending email messages.
Definition: SmtpClient.qm.dox.h:969
*string getDesc()
Returns the data provider description.
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
const ProviderInfo
Provider info.
Definition: SmtpClient.qm.dox.h:973
constructor(SmtpClient smtp)
Creates the object from an SmtpClient object.
SmtpClient smtp
The SmtpClient object.
Definition: SmtpClient.qm.dox.h:993
constructor(*hash< auto > options)
Creates the object from constructor options.
const ConstructorOptions
Constructor options.
Definition: SmtpClient.qm.dox.h:983
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
*list< hash< DataProviderSummaryInfo > > getChildProviderSummaryInfo()
Return data provider summary info.
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
connect()
Connect to the server with the connection parameters set in the constructor()
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
test(bool ns)
sets or disables test mode; no connections are made in test mode
clearStats()
Clears performance statistics.
hash< auto > getInfo()
Returns info about the connection.
setReadTimeout(timeout to)
sets the read timeout
tls(bool n_tls)
sets the TLS/SSL flag
bool isConnected()
return connection status
date getReadTimeoutDate()
returns the read timeout as a relative time value
setInfoLogClosure(*code log)
Set info log closure.
bool tls()
returns the TLS/SSL flag
constructor(string url, *code log, *code dbglog)
creates the SmtpClient object
setDebugLogClosure(*code log)
Set debug log closure.
int getConnectTimeoutMs()
returns the connect timeout as an integer giving milliseconds
int getReadTimeoutMs()
returns the read timeout as an integer giving milliseconds
bool ssl()
returns the SSL connection flag
forceDisconnect()
force disconnect of socket without error
ssl(bool n_ssl)
sets the SSL connection flag
string getTarget()
Returns the connection target string.
disconnect()
disconnect from the server
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
constructor(string host, softint port, *code log, *code dbglog)
creates the SmtpClient object
date getConnectTimeoutDate()
returns the connect timeout as a relative time value
setConnectTimeout(timeout to)
sets the connect timeout
setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive socket events.
setEventQueue()
Removes any Queue object.
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
bool test()
returns the test mode flag
hash< auto > sendMessage(MailMessage::Message message)
send a Message to the server
setUserPass(string n_user, string n_pass)
sets the username and password for authenticated connections
destructor()
disconnects if connected and destroys the object
Send email data provider.
Definition: SmtpClient.qm.dox.h:1046
const RequestType
Request type.
Definition: SmtpClient.qm.dox.h:1067
string getName()
Returns the data provider name.
auto doRequestImpl(auto req, *hash< auto > request_options)
Makes a request and returns the response.
*AbstractDataProviderType getResponseTypeImpl()
Returns the description of a response message, if this object represents a response message.
*AbstractDataProviderType getRequestTypeImpl()
Returns the description of a successful request message, if any.
const ProviderInfo
Provider info.
Definition: SmtpClient.qm.dox.h:1053
constructor(SmtpClient smtp)
Creates the object from an SMTP connection.
const ProviderSummaryInfo
Provider summary info.
Definition: SmtpClient.qm.dox.h:1062
SmtpClient smtp
SMTP connection.
Definition: SmtpClient.qm.dox.h:1050
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
constructor(*hash< auto > options)
Creates the object from constructor options.
const ResponseType
Response type.
Definition: SmtpClient.qm.dox.h:1070
class for SMTP connections; returns an object of class SmtpClient for sending emails
Definition: SmtpClient.qm.dox.h:870
bool supportsPollingApi()
returns True, since this connection type supports the Qore Socket-based polling API
setChildCapabilities()
Sets child data provider capabilities.
constructor(string name, string description, string url, hash< auto > attributes={}, hash< auto > options={})
creates the SmtpConnection connection object
DataProvider::AbstractDataProvider getDataProvider()
returns an SmtpClientDataProvider object for this connection
Qore::AbstractPollOperation startPollConnect()
Called to start a non-blocking polling ping operation on the remote SMTP server.
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
const ConnectionScheme
Connection entry info.
Definition: SmtpClient.qm.dox.h:874
SmtpClient getImpl(bool connect=True, *hash< auto > rtopts)
returns an SmtpClient object
bool hasDataProvider()
returns True, as the connection returns a data provider with the getDataProvider() method
*hash< auto > getRuntimeOptions()
returns runtime options
string getType()
returns "smtp"
Class for SMTP non-blocking / polling pings.
Definition: SmtpClient.qm.dox.h:747
hash< auto > info
Info about the SMTP client.
Definition: SmtpClient.qm.dox.h:782
Socket sock()
The Socket for communication with the server.
bool esmtp
ESMTP flag.
Definition: SmtpClient.qm.dox.h:800
startLogin()
Starts the polling login state.
bool goal_reached
Goal reached flag.
Definition: SmtpClient.qm.dox.h:797
const SPS_LOGIN
Login state.
Definition: SmtpClient.qm.dox.h:772
const SPS_SEND_HELLO
Send hello state.
Definition: SmtpClient.qm.dox.h:757
string state
Current state.
Definition: SmtpClient.qm.dox.h:794
const SPS_CONNECT
Connect state.
Definition: SmtpClient.qm.dox.h:751
const SPS_READ_LOGIN_REPLY
Read login reply.
Definition: SmtpClient.qm.dox.h:775
const SPS_STARTTLS
Send STARTTLS state.
Definition: SmtpClient.qm.dox.h:763
AbstractPollOperation poller
The current internal poll operation.
Definition: SmtpClient.qm.dox.h:788
int starttls_code
Server's STARTTLS code.
Definition: SmtpClient.qm.dox.h:809
const SPS_UPGRADE_TO_TLS
Upgrade socket connection to TLS.
Definition: SmtpClient.qm.dox.h:769
string getState()
Returns the current state.
int hello_reply_code
Server's HELO / EHLO reply code.
Definition: SmtpClient.qm.dox.h:803
int login_code
Server's login code.
Definition: SmtpClient.qm.dox.h:815
const SPS_COMPLETE
Complete state.
Definition: SmtpClient.qm.dox.h:778
Mutex m()
Lock for atomicity.
string hello_reply
Server's HELO / EHLO reply.
Definition: SmtpClient.qm.dox.h:806
*hash< SocketPollInfo > continuePoll()
Returns a hash to be used for I/O polling or NOTHING in case the poll operation is complete.
constructor(SmtpClient smtp)
Creates the object based on the SmtpClient.
const SPS_READ_HELLO_REPLY
Read hello reply state.
Definition: SmtpClient.qm.dox.h:760
string getGoal()
Returns the goal.
const SPS_READ_STARTTLS_REPLY
Read STARTTLS reply.
Definition: SmtpClient.qm.dox.h:766
const SPS_READ_HELLO
Read hello state.
Definition: SmtpClient.qm.dox.h:754
bool getReply(reference< int > rcode, reference< string > rmsg)
Private reads a reply from the SMTP server.
string starttls_reply
Server's STARTTLS reply.
Definition: SmtpClient.qm.dox.h:812
string login_reply
Server's login reply.
Definition: SmtpClient.qm.dox.h:818
bool goalReached()
Returns True when the goal as been reached.
SMTP attachment type.
Definition: SmtpClient.qm.dox.h:1117
constructor()
Creates the object.
const Fields
Field descriptions.
Definition: SmtpClient.qm.dox.h:1122
SMTP send email request type.
Definition: SmtpClient.qm.dox.h:1161
constructor()
Creates the object.
const Fields
Field descriptions.
Definition: SmtpClient.qm.dox.h:1166
SMTP send email response data type.
Definition: SmtpClient.qm.dox.h:1243
constructor()
Creates the object.
SMTP send email response info type.
Definition: SmtpClient.qm.dox.h:1219
constructor()
Creates the object.
const Fields
Field descriptions.
Definition: SmtpClient.qm.dox.h:1224
the SmtpClient namespace holds all public definitions in the SmtpClient module
Definition: SmtpClient.qm.dox.h:228
const DefaultConnectTimeout
30 second connect timeout
Definition: SmtpClient.qm.dox.h:233
const DefaultReadTimeout
15 second read timeout
Definition: SmtpClient.qm.dox.h:230
internal response hash
Definition: SmtpClient.qm.dox.h:236
int code
The response code.
Definition: SmtpClient.qm.dox.h:238
string desc
The response string.
Definition: SmtpClient.qm.dox.h:241