OPEN_CONNECTION is used to open a connection to an SMTP service and return the connection object.
Applicability
This content applies only to the Oracle-compatible mode of OceanBase Database.
Syntax
UTL_SMTP.OPEN_CONNECTION (
host IN VARCHAR2,
port IN PLS_INTEGER DEFAULT 25,
c OUT connection,
tx_timeout IN PLS_INTEGER DEFAULT NULL,
wallet_path IN VARCHAR2 DEFAULT NULL,
wallet_password IN VARCHAR2 DEFAULT NULL,
secure_connection_before_smtp IN BOOLEAN DEFAULT FALSE,
secure_host IN VARCHAR2 DEFAULT NULL)
RETURN reply;
UTL_SMTP.OPEN_CONNECTION (
host IN VARCHAR2,
port IN PLS_INTEGER DEFAULT 25,
tx_timeout IN PLS_INTEGER DEFAULT NULL,
wallet_path IN VARCHAR2 DEFAULT NULL,
wallet_password IN VARCHAR2 DEFAULT NULL,
secure_connection_before_smtp IN BOOLEAN DEFAULT FALSE,
secure_host IN VARCHAR2 DEFAULT NULL)
RETURN connection;
Parameters
| Parameter | Description |
|---|---|
| host | The hostname of the SMTP service. |
| port | The port number of the SMTP service (usually 25). |
| c | The SMTP connection. |
| tx_timeout | The number of seconds that the UTL_SMTP package waits before timing out on a read or write operation. In a read operation, this package times out if no data is available for immediate reading. In a write operation, this package times out if the output buffer is full and data cannot be sent to the network without being blocked. The value 0 specifies not to wait, and NULL specifies to wait indefinitely. |
| wallet_path | Currently, this parameter is not supported. The default value is NULL. |
| wallet_password | Currently, this parameter is not supported. The default value is NULL. |
| secure_connection_before_smtp | If set to TRUE, a secure connection is established using SSL/TLS before SMTP communication. If set to FALSE, no secure connection is established. (Currently, only FALSE is supported.) |
| secure_host | Currently, this parameter is not supported. The default value is NULL. |
Return value
| Return value | Description |
|---|---|
| reply | The reply code of the command. If multiple reply codes are returned, the last one is returned. |
Considerations
- The expected reply code is
220, indicating that the SMTP server is ready to handle requests from the client. - The version that returns
utl_smtp.connectionwill check the reply code, and if the reply indicates an error, an exception will be raised. The version that returnsutl_smtp.replyleaves it to the user to check the reply. tx_timeoutis intended to manage read and write operations. However, implementation limitations preventtx_timeoutfrom managing write operations in the current version.