Qore SmtpClient Module Reference
1.9.3
|
The SmtpClient module provides a set of classes that can be used for easy communication with SMTP servers for sending emails, with or without TLS/SSL encryption.
To use this module, use "%requires SmtpClient"
in your code. See examples/email.q for an example program using this module
All the public symbols in the module are defined in the SmtpClient namespace
Classes provided:
The following supporting classes are provided by the MailMessage module:
Note that the SmtpClient class automatically detects if the SMTP server supports ESMTP and a "EHLO"
command is executed automatically instead of "HELO"
if so. Additionally, the class also automatically detects if the server supports the "STARTTLS"
command by parsing the response to the "EHLO"
command when talking to ESMTP servers.
If the tls flag is not set on the SmtpClient object and the server supports "STARTTLS"
(and a transport layer TLS/SSL connection was not already established), then the SmtpClient object will automatically execute a "STARTTLS"
command after connecting so that the rest of the SMTP session is performed securely. This also allows transparent logins and communication with ESMTP servers that require secure connections.
For the above reasons it's normally not required to use the "smtptls"
or "esmtptls"
protocols in the SmtpClient::constructor(string, *code, *code) RL argument.
SmtpClient::constructor(string, *code, *code) takes a URL argument, the protocol (scheme) component is handled as in the following table.
SmtpcClient Protocol Handling
Protocol | Default Port | Description |
"smtp" | 25 | standard SMTP port without encryption; ESMPT and "STARTTLS" detection is supported automatically |
"smtps" | 465 | note that port 465 is currently assigned to source-specific multicast audio/video </td> |
(http://www.iana.org/assignments/port-numbers); \ its use as a port for secure SMTP listeners (where security is enforced at the transport layer because the \ server immediately negotiates a TLS/SSL connection before the application protocol communication starts) is \ deprecated but is included in this module because many SMTP servers still operate this way
"smtptls" | 25 | a "STARTTLS" command is executed unconditionally after the connection to ensure a secure </td> |
connection, even if the server does not declare support for this command in the login response. It's \ normally not necessary to use this protocol as "STARTTLS"
is used automatically when logging in to ESMTP \ servers that declare support for this command in the response to the "EHLO"
command.
"esmtp" | 587 | like "smtp" just using port 587 |
"esmtps" | 465 | like "smtps" |
"esmtptls" | 587 | like "smtptls" just using port 587 |
Based on:
"."
characters on a line in serialized data (issue issue 3275)"estmps"
scheme for completeness (issue 2833)SmtpConnection::getConstructorInfo()
and SmtpConnection::getConstructorInfoImpl()
methods (issue 3696)SmtpConnection::getConstructorInfo()
method to allow connections to be created dynamically, potentially in another process from a network call (removed in SmtpClient 1.8) (issue 2628)