310 bool logged_in = False;
319 hash<auto> hello_reply;
321 const MaxDebugLine = 2048;
335 const SmtpsPort = 465;
338 const EsmtpPort = 587;
598 nothing
setWarningQueue(
int warning_ms,
int warning_bs, Queue queue,
auto arg, timeout min_ms = 1s);
678 final disconnectIntern();
704 sendDataIntern(data str);
710 sendData(
string str);
723 final hash<SmtpResponseInfo> sendCommand(
string str);
729 string readLine(timeout to);
741 forceDisconnectIntern();
859 bool getReply(reference<int> rcode, reference<string> rmsg);
876 "cls": Class::forName(
"SmtpConnection"),
890 constructor(
string name,
string description,
string url, hash<auto> attributes = {}, hash<auto> options = {})
975 "type":
"SmtpClientDataProvider",
976 "supports_children": True,
978 "children_can_support_apis": True,
979 "children_can_support_records": False,
980 "children_can_support_observers": False,
985 "url": <DataProviderOptionInfo>{
986 "type": AbstractDataProviderType::get(StringType),
987 "desc":
"A URL for an SMTP server",
997 "send-email": Class::forName(
"SmtpClient::SmtpClientSendEmailDataProvider"),
1055 "name":
"send-email",
1056 "desc":
"SMTP send email data provider",
1057 "type":
"SmtpClientSendEmailDataProvider",
1059 "supports_request": True,
1064 AbstractDataProvider::DataProviderSummaryInfoKeys
1126 "desc":
"The data for the attachment",
1131 "desc":
"The encoding to use for the attachment:\n"
1132 "- `default`: `quoted-printable` for string data, `base64` for binary data\n"
1133 "- `none`: no content encoding (not recommended)\n"
1134 "- `quoted-printable`: quoted printable encoding \n"
1135 "- `base64`: base64 encoding",
1136 "default_value":
"default",
1139 "type": HashOrNothingType,
1140 "desc":
"Optional headers to send with the attachment",
1144 "desc":
"The MIME type of the attachment",
1149 "desc":
"The name or filename of the attachment",
1170 "desc":
"Any attachments for the message",
1173 "type":
new SoftListDataType(StringType, True),
1174 "desc":
"One or more `Bcc:` addresses for the email",
1178 "desc":
"The message body",
1182 "desc":
"The encoding to use for the attachment:\n"
1183 "- `default`: `quoted-printable` for string data, `base64` for binary data\n"
1184 "- `none`: no content encoding (not recommended)\n"
1185 "- `quoted-printable`: quoted printable encoding \n"
1186 "- `base64`: base64 encoding",
1187 "default_value":
"default",
1190 "type": StringOrNothingType,
1191 "desc":
"The MIME type of the message body",
1194 "type":
new SoftListDataType(StringType, True),
1195 "desc":
"One or more `Cc:` addresses for the email",
1199 "desc":
"The sender address for the email",
1204 "desc":
"The subject for the email",
1207 "type":
new SoftListDataType(StringType, True),
1208 "desc":
"One or more `To:` addresses for the email",
1228 "desc":
"The return code provided by the SMTP server for the command",
1232 "desc":
"The string description returned by the server",
1258 static Class
cls =
new Class(
"SmtpClientDataProvider");
1262 "name":
"smtpclient",
1263 "desc":
"SMTP client data provider factory",
1264 "children_can_support_apis": True,
for backwards-compatibility only
Definition: SmtpClient.qm.dox.h:266
for backwards-compatibility and convenience
Definition: SmtpClient.qm.dox.h:246
constructor(string sender, string subject)
creates a Message object from the arguments given
The SMTP data provider factory.
Definition: SmtpClient.qm.dox.h:1253
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:1258
Class getClassImpl()
Returns the class for the data provider object.
const FactoryInfo
Factory info.
Definition: SmtpClient.qm.dox.h:1261
Data provider implementing an API for sending email messages.
Definition: SmtpClient.qm.dox.h:970
*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:974
constructor(SmtpClient smtp)
Creates the object from an SmtpClient object.
SmtpClient smtp
The SmtpClient object.
Definition: SmtpClient.qm.dox.h:994
constructor(*hash< auto > options)
Creates the object from constructor options.
const ConstructorOptions
Constructor options.
Definition: SmtpClient.qm.dox.h:984
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:1047
const RequestType
Request type.
Definition: SmtpClient.qm.dox.h:1068
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:1054
constructor(SmtpClient smtp)
Creates the object from an SMTP connection.
const ProviderSummaryInfo
Provider summary info.
Definition: SmtpClient.qm.dox.h:1063
SmtpClient smtp
SMTP connection.
Definition: SmtpClient.qm.dox.h:1051
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:1071
class for SMTP connections; returns an object of class SmtpClient for sending emails
Definition: SmtpClient.qm.dox.h:871
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:875
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:748
hash< auto > info
Info about the SMTP client.
Definition: SmtpClient.qm.dox.h:783
Socket sock()
The Socket for communication with the server.
bool esmtp
ESMTP flag.
Definition: SmtpClient.qm.dox.h:801
startLogin()
Starts the polling login state.
bool goal_reached
Goal reached flag.
Definition: SmtpClient.qm.dox.h:798
const SPS_LOGIN
Login state.
Definition: SmtpClient.qm.dox.h:773
const SPS_SEND_HELLO
Send hello state.
Definition: SmtpClient.qm.dox.h:758
string state
Current state.
Definition: SmtpClient.qm.dox.h:795
const SPS_CONNECT
Connect state.
Definition: SmtpClient.qm.dox.h:752
const SPS_READ_LOGIN_REPLY
Read login reply.
Definition: SmtpClient.qm.dox.h:776
const SPS_STARTTLS
Send STARTTLS state.
Definition: SmtpClient.qm.dox.h:764
AbstractPollOperation poller
The current internal poll operation.
Definition: SmtpClient.qm.dox.h:789
int starttls_code
Server's STARTTLS code.
Definition: SmtpClient.qm.dox.h:810
const SPS_UPGRADE_TO_TLS
Upgrade socket connection to TLS.
Definition: SmtpClient.qm.dox.h:770
string getState()
Returns the current state.
int hello_reply_code
Server's HELO / EHLO reply code.
Definition: SmtpClient.qm.dox.h:804
int login_code
Server's login code.
Definition: SmtpClient.qm.dox.h:816
const SPS_COMPLETE
Complete state.
Definition: SmtpClient.qm.dox.h:779
Mutex m()
Lock for atomicity.
string hello_reply
Server's HELO / EHLO reply.
Definition: SmtpClient.qm.dox.h:807
*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:761
string getGoal()
Returns the goal.
const SPS_READ_STARTTLS_REPLY
Read STARTTLS reply.
Definition: SmtpClient.qm.dox.h:767
const SPS_READ_HELLO
Read hello state.
Definition: SmtpClient.qm.dox.h:755
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:813
string login_reply
Server's login reply.
Definition: SmtpClient.qm.dox.h:819
bool goalReached()
Returns True when the goal as been reached.
SMTP attachment type.
Definition: SmtpClient.qm.dox.h:1118
constructor()
Creates the object.
const Fields
Field descriptions.
Definition: SmtpClient.qm.dox.h:1123
SMTP send email request type.
Definition: SmtpClient.qm.dox.h:1162
constructor()
Creates the object.
const Fields
Field descriptions.
Definition: SmtpClient.qm.dox.h:1167
SMTP send email response data type.
Definition: SmtpClient.qm.dox.h:1244
constructor()
Creates the object.
SMTP send email response info type.
Definition: SmtpClient.qm.dox.h:1220
constructor()
Creates the object.
const Fields
Field descriptions.
Definition: SmtpClient.qm.dox.h:1225
the SmtpClient namespace holds all public definitions in the SmtpClient module
Definition: SmtpClient.qm.dox.h:229
const DefaultConnectTimeout
30 second connect timeout
Definition: SmtpClient.qm.dox.h:234
const DefaultReadTimeout
15 second read timeout
Definition: SmtpClient.qm.dox.h:231
internal response hash
Definition: SmtpClient.qm.dox.h:237
int code
The response code.
Definition: SmtpClient.qm.dox.h:239
string desc
The response string.
Definition: SmtpClient.qm.dox.h:242