The OPEN_CONNECTION procedure opens a connection to an SMTP service and returns it.
Applicability
This topic applies only to OceanBase Database in Oracle mode.
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 host name of the SMTP service. |
| port | The port number of the SMTP service (usually 25). |
| c | The SMTP connection. |
| tx_timeout | The wait time (in seconds) before the UTL_SMTP package times out for read and write operations on the connection. In a read operation, the package times out if no data is immediately available. In a write operation, the package times out if the output buffer is full and no data is sent to the network without being blocked. 0 indicates no wait, and NULL indicates an indefinite wait. |
| wallet_path | This parameter is not supported and defaults to NULL. |
| wallet_password | This parameter is not supported and defaults to NULL. |
| secure_connection_before_smtp | If TRUE, a secure connection is established using SSL/TLS before SMTP communication. If FALSE, no secure connection is established. (Only FALSE is supported.) |
| secure_host | This parameter is not supported and defaults to NULL. |
Return value
| Return value | Description |
|---|---|
| reply | The reply to the command. If multiple replies 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.connectionchecks the reply code and throws an exception if an error is indicated. The version that returnsutl_smtp.replyrequires 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.