Establish a connection with a server.
[RemotePort], [UserName], [Password],
[Timeout], [Options] )
- A string which specifies the host name or IP address of the
server. If this argument is not specified, it defaults to the
value of the HostAddress property if it is defined.
Otherwise, it defaults to the value of the HostName
- A number which specifies the port to connect to on the server.
If this argument is not specified, it defaults to the value
of the RemotePort property. A value of zero indicates that
the default port number for this service should be used to
establish the connection. If the secure port number is specified,
an implicit SSL/TLS connection will be established by default.
- A string which specifies the name of the user used to
authenticate access to the server. If this argument is not
specified, it defaults to the value of the UserName
- A string which specifies the password used to authenticate the
user. If you are using an OAuth 2.0 authentication method, this
property should specify the access token provided by the mail service
and not the user password. Refer to the AuthType
property for more information about the supported authentication
methods. If this argument is not specified, it defaults to the
value of the BearerToken or Password
property, depending on the authentication method specified.
- The number of seconds that the client will wait for a response
before failing the operation. If this argument is not specified,
the value of the Timeout property will be used as the default.
- A numeric value which specifies one or more options. If this
argument is omitted or a value of zero is specified, a default
connection will be established. This argument is constructed by
using a bitwise operator with any of the following values:
|No connection options specified. A standard connection to
the server will be established using the specified host name
and port number.
|This option specifies the client should identify itself
to the server. If enabled, the client will send the ID command
to the server as defined in RFC 2971. This option has no effect
if the server does not support the ID command.
|This option specifies that a tunneled TCP connection and/or
port-forwarding is being used to establish the connection to
the server. This changes the behavior of the client with
regards to internal checks of the destination IP address and
remote port number, default capability selection and how the
connection is established.
|This option specifies the server is trusted. The
server certificate will not be validated and the connection
will always be permitted. This option only affects connections
using either the SSL or TLS protocols.
|This option specifies that a secure connection should be
established with the server and requires that the server
support either the SSL or TLS protocol. This option initiates
the secure session using the STARTTLS command.
|This option specifies the client should attempt to
establish a secure connection with the server. The server must
support secure connections using either the SSL or TLS
protocol, and the secure session must be negotiated immediately
after the connection has been established.
|This option specifies the client should permit the use of
less secure cipher suites for compatibility with legacy servers.
If this option is specified, the client will allow connections
using TLS 1.0 and cipher suites that use RC4, MD5 and SHA1.
|This option specifies the client should prefer the use of
IPv6 if the server hostname can be resolved to both an IPv6 and
IPv4 address. This option is ignored if the local system does
not have IPv6 enabled, or when the hostname can only be resolved
to an IPv4 address. If the server hostname can only be resolved
to an IPv6 address, the client will attempt to establish a
connection using IPv6 regardless if this option has been
A value of zero is returned if the connection was successful.
Otherwise, a non-zero error code is returned which indicates the
cause of the failure.