public abstract class EmailClient extends Object implements com.aspose.ms.System.IDisposable
Represents the client that creates server connection by using the host credentials.
Modifier | Constructor and Description |
---|---|
protected |
EmailClient(String type)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
int securityOptions)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
String username,
ITokenProvider tokenProvider)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
String username,
ITokenProvider tokenProvider,
int securityOptions)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
String username,
String password)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
String username,
String authInfo,
boolean useOAuth)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
String username,
String authInfo,
boolean useOAuth,
int securityOptions)
Initializes a new instance of the
EmailClient class. |
protected |
EmailClient(String type,
String host,
int port,
String username,
String password,
int securityOptions)
Initializes a new instance of the
EmailClient class. |
Modifier and Type | Method and Description |
---|---|
void |
bindIPEndPoint(BindIPEndPointHandler handler)
Associates a Socket with a local endpoint.
|
void |
cancelAsyncOperation(com.aspose.ms.System.IAsyncResult asyncResult)
Cancels asynchronous operation.
|
void |
connectIPEndPoint(BindIPEndPointHandler handler)
Associates a Socket with a remote endpoint.
|
IConnection |
createConnection()
Creates new independent connection for operations not linked to threads (not default connection).
|
IConnection |
createConnection(boolean createAsDefaultConnection)
Creates new (default or independent) connection for operations.
|
void |
dispose()
Finalizes all operations with a server.
|
protected void |
dispose(boolean disposing)
Finalizes all operations with a server.
|
protected void |
finalize()
Releases unmanaged resources and performs other cleanup operations before the
EmailClient is reclaimed by garbage collection. |
String |
getAccessToken()
Gets or sets the access token.
|
String[] |
getCapabilities()
Get Capabilities.
|
com.aspose.ms.System.Security.Cryptography.X509Certificates.X509CertificateCollection |
getClientCertificates()
Contains collection of clients certificates
|
int |
getConnectionAsgmtMode()
Gets or sets value which defines mode of connection allocation in multiple threads environment
There are folowing connection types:
- Main connection is connection created and disposed together with mail client.It can't be created or disposed manually.
|
int |
getConnectionCheckupPeriod()
Period of connection checking up in milliseconds.
|
int |
getConnectionsQuantity()
Gets or sets quantity of connections in multy-connection mode
|
int |
getConnectionState()
Gets the current state of the connection.
|
IConnection |
getCurrentConnection()
Gets current connection according to ConnectionAsgmtMode option
|
int |
getDefaultPort()
Gets default port for client
|
boolean |
getEnableLogger()
Gets or sets value which allows enable/disable logger
|
String |
getHost()
Gets or sets the host name.
|
String |
getLogFileName()
Gets or sets log file name
|
String |
getPassword()
Gets or sets the password.
|
int |
getPort()
Gets or sets the port.
|
Proxy |
getProxy()
Gets or sets proxy for the client
|
int |
getSecurityOptions()
Security mode for a mail client
|
int |
getSupportedEncryption()
Defines the versions of SSL/TLS encription protocols to be uised.
|
int |
getTimeout()
Gets or sets the timeout for mail operations
|
ITokenProvider |
getTokenProvider()
Gets or sets TokenProvider allowing to retrieve access token.
|
boolean |
getUseAuthentication()
Indicates whether authentication is used.
|
boolean |
getUseDateInLogFileName()
Gets or sets value which indicates if date has to be used in log file name.
|
boolean |
getUseDefaultCredentials()
Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.
|
int |
getUseMultiConnection()
Gets or sets value which indicates if client has to use multiple connections for heavy loaded operations.
|
int |
getUseMultyConnection()
Deprecated.
This property is obsolete and will be removed soon. Please, use UseMultiConnection instead.
|
PipeliningStatus |
getUsePipelining()
Gets or sets object which indicates whether the pipelining mode is enabled.
|
String |
getUsername()
Gets or sets the username.
|
abstract void |
noop()
'No operation' command
|
abstract void |
noop(IConnection connection)
'No operation' command
|
void |
resetLogSettings()
Resets logging settings to default.
|
void |
setAccessToken(String value)
Gets or sets the access token.
|
void |
setConnectionAsgmtMode(int value)
Gets or sets value which defines mode of connection allocation in multiple threads environment
There are folowing connection types:
- Main connection is connection created and disposed together with mail client.It can't be created or disposed manually.
|
void |
setConnectionCheckupPeriod(int value)
Period of connection checking up in milliseconds.
|
void |
setConnectionsQuantity(int value)
Gets or sets quantity of connections in multy-connection mode
|
void |
setEnableLogger(boolean value)
Gets or sets value which allows enable/disable logger
|
void |
setHost(String value)
Gets or sets the host name.
|
void |
setLogFileName(String value)
Gets or sets log file name
|
void |
setPassword(String value)
Gets or sets the password.
|
void |
setPort(int value)
Gets or sets the port.
|
void |
setProxy(Proxy value)
Gets or sets proxy for the client
|
void |
setSecurityOptions(int value)
Security mode for a mail client
|
static void |
setSocketsLayerVersion2(boolean value)
Sets value indicating whether Sockets Layer version 2 is used.
|
static void |
setSocketsLayerVersion2DisableSSLCertificateValidation(boolean value)
Disable SSL certificate validation for Sockets Layer version 2
|
void |
setSupportedEncryption(int value)
Defines the versions of SSL/TLS encription protocols to be uised.
|
void |
setTimeout(int value)
Gets or sets the timeout for mail operations
|
void |
setTokenProvider(ITokenProvider value)
Gets or sets TokenProvider allowing to retrieve access token.
|
void |
setUseAuthentication(boolean value)
Indicates whether authentication is used.
|
void |
setUseDateInLogFileName(boolean value)
Gets or sets value which indicates if date has to be used in log file name.
|
void |
setUseDefaultCredentials(boolean value)
Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.
|
void |
setUseMultiConnection(int value)
Gets or sets value which indicates if client has to use multiple connections for heavy loaded operations.
|
void |
setUseMultyConnection(int value)
Deprecated.
This property is obsolete and will be removed soon. Please, use UseMultiConnection instead.
|
void |
setUsePipelining(PipeliningStatus value)
Gets or sets object which indicates whether the pipelining mode is enabled.
|
void |
setUsername(String value)
Gets or sets the username.
|
protected EmailClient(String type)
Initializes a new instance of the EmailClient
class.
protected EmailClient(String type, String host, int port)
Initializes a new instance of the EmailClient
class.
host
- The host name.port
- The port number.protected EmailClient(String type, String host, int port, int securityOptions)
Initializes a new instance of the EmailClient
class.
host
- The host name.port
- The port number.securityOptions
- Security mode for a mail clientprotected EmailClient(String type, String host, int port, String username, String password)
Initializes a new instance of the EmailClient
class.
host
- The host name.port
- The port number.username
- The username.password
- The password.protected EmailClient(String type, String host, int port, String username, String password, int securityOptions)
Initializes a new instance of the EmailClient
class.
host
- The host name.port
- The port number.username
- The username.password
- The password.securityOptions
- Security mode for a mail clientprotected EmailClient(String type, String host, int port, String username, String authInfo, boolean useOAuth)
Initializes a new instance of the EmailClient
class.
host
- The host.port
- The port.username
- The username.authInfo
- A string representation of the user password or the access token.useOAuth
- Defines whether OAuth is used to login to the serverprotected EmailClient(String type, String host, int port, String username, String authInfo, boolean useOAuth, int securityOptions)
Initializes a new instance of the EmailClient
class.
host
- The host.port
- The port.username
- The username.authInfo
- A string representation of the user password or the access token.useOAuth
- Defines whether OAuth is used to login to the serversecurityOptions
- Security mode for a mail clientprotected EmailClient(String type, String host, int port, String username, ITokenProvider tokenProvider)
Initializes a new instance of the EmailClient
class.
host
- The host.port
- The port.username
- The username.tokenProvider
- TokenProvider allowing to retrieve access token.protected EmailClient(String type, String host, int port, String username, ITokenProvider tokenProvider, int securityOptions)
Initializes a new instance of the EmailClient
class.
host
- The host.port
- The port.username
- The username.tokenProvider
- TokenProvider allowing to retrieve access token.securityOptions
- public static void setSocketsLayerVersion2(boolean value)
Sets value indicating whether Sockets Layer version 2 is used. By default, Sockets Layer version 1 is used.
value
- True if Sockets Layer version 2 should be used.public static void setSocketsLayerVersion2DisableSSLCertificateValidation(boolean value)
Disable SSL certificate validation for Sockets Layer version 2
public final void resetLogSettings()
Resets logging settings to default.
public final boolean getEnableLogger()
Gets or sets value which allows enable/disable logger
public final void setEnableLogger(boolean value)
Gets or sets value which allows enable/disable logger
public final String getLogFileName()
Gets or sets log file name
public final void setLogFileName(String value)
Gets or sets log file name
public final boolean getUseDateInLogFileName()
Gets or sets value which indicates if date has to be used in log file name.
public final void setUseDateInLogFileName(boolean value)
Gets or sets value which indicates if date has to be used in log file name.
public int getSupportedEncryption()
Defines the versions of SSL/TLS encription protocols to be uised.
public void setSupportedEncryption(int value)
Defines the versions of SSL/TLS encription protocols to be uised.
public com.aspose.ms.System.Security.Cryptography.X509Certificates.X509CertificateCollection getClientCertificates()
Contains collection of clients certificates
public PipeliningStatus getUsePipelining()
Gets or sets object which indicates whether the pipelining mode is enabled.
public void setUsePipelining(PipeliningStatus value)
Gets or sets object which indicates whether the pipelining mode is enabled.
public String getHost()
Gets or sets the host name.
Value: The host name.public void setHost(String value)
Gets or sets the host name.
Value: The host name.public int getDefaultPort()
Gets default port for client
public int getPort()
Gets or sets the port.
Value: The port number.public void setPort(int value)
Gets or sets the port.
Value: The port number.public int getSecurityOptions()
Security mode for a mail client
public void setSecurityOptions(int value)
Security mode for a mail client
public boolean getUseAuthentication()
Indicates whether authentication is used.
public void setUseAuthentication(boolean value)
Indicates whether authentication is used.
public int getConnectionCheckupPeriod()
Period of connection checking up in milliseconds. Default value is 5 min.
public void setConnectionCheckupPeriod(int value)
Period of connection checking up in milliseconds. Default value is 5 min.
public boolean getUseDefaultCredentials()
Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.
public void setUseDefaultCredentials(boolean value)
Gets or sets a Boolean value that controls whether the DefaultCredentials are sent with requests.
public Proxy getProxy()
Gets or sets proxy for the client
public void setProxy(Proxy value)
Gets or sets proxy for the client
public final int getTimeout()
Gets or sets the timeout for mail operations
Value: The timeout in millisecondspublic final void setTimeout(int value)
Gets or sets the timeout for mail operations
Value: The timeout in millisecondspublic String getPassword()
Gets or sets the password.
Value: The string that represents the password.public void setPassword(String value)
Gets or sets the password.
Value: The string that represents the password.public String getAccessToken()
Gets or sets the access token.
Value: The string that represents access token.public void setAccessToken(String value)
Gets or sets the access token.
Value: The string that represents access token.public final ITokenProvider getTokenProvider()
Gets or sets TokenProvider allowing to retrieve access token.
public final void setTokenProvider(ITokenProvider value)
Gets or sets TokenProvider allowing to retrieve access token.
public String getUsername()
Gets or sets the username.
Value: The username string.public void setUsername(String value)
Gets or sets the username.
Value: The username string.public String[] getCapabilities()
Get Capabilities.
public final int getConnectionState()
Gets the current state of the connection.
public void bindIPEndPoint(BindIPEndPointHandler handler)
Associates a Socket with a local endpoint.
public void connectIPEndPoint(BindIPEndPointHandler handler)
Associates a Socket with a remote endpoint.
public final void cancelAsyncOperation(com.aspose.ms.System.IAsyncResult asyncResult)
Cancels asynchronous operation.
asyncResult
- Defines asynchronous operation to cancel.public abstract void noop()
'No operation' command
public abstract void noop(IConnection connection)
'No operation' command
connection
- Connection to a serverpublic void dispose()
Finalizes all operations with a server.
dispose
in interface com.aspose.ms.System.IDisposable
protected void dispose(boolean disposing)
Finalizes all operations with a server.
disposing
- true
to release both managed and unmanaged resources; false
to release only unmanaged resources.protected void finalize() throws Throwable
Releases unmanaged resources and performs other cleanup operations before the
EmailClient
is reclaimed by garbage collection.
public IConnection createConnection()
Creates new independent connection for operations not linked to threads (not default connection). Invocation of this method is similar to invocation of CreateConnection(createAsDefaultConnection = false) Please see more in documentation for EmailClient.ConnectionAsgmtMode property.
public IConnection createConnection(boolean createAsDefaultConnection)
Creates new (default or independent) connection for operations. Please see more in documentation for EmailClient.ConnectionAsgmtMode property.
createAsDefaultConnection
- Indicates if connection has to be created as default for current threadpublic IConnection getCurrentConnection()
Gets current connection according to ConnectionAsgmtMode option
public int getConnectionAsgmtMode()
Gets or sets value which defines mode of connection allocation in multiple threads environment There are folowing connection types: - Main connection is connection created and disposed together with mail client.It can't be created or disposed manually. - Default connection is connection default for some thread. If default connection exists and ConnectionAsgmtMode allow, all methods of email client executed in this thread will be implicitly use this connection. Only one default connection can be exist per thread. It can be created manually or automatically. It depends on EmailClient.ConnectionAsgmtMode property. These connections can be created manually with EmailClient.CreateConnection(createAsDefaultConnection = true) method. If default connection does not used(depends on connection allocation mode), main connection used implicitly instead of it. - Independent connections are connections that are not linked to threads.They can be created manually and has to be used explicitly as method parameter. These connections can be created manually with EmailClient.CreateConnection() method or EmailClient.CreateConnection(createAsDefaultConnection = false) method. There are folowing connection allocation types: - ConnectionAsgmtType.UseMainOrDefault This mode uses by default in email clients. Email client uses main connection for all operations from multiple threads if default connection hasn't been created, or connection hasnt been passed as method parameter explicitly. Main connection is connection which is created in the same time like email client. User can create default connections for threads with CreateConnection method. If default connection for thread is created, it's used implicitly for all methods of email client which are invoked in this thread. If default connection for thread is not created, main connection is used for all methods of email client which are invoked in this thread. User also can create connections not linked with threads (not default connections) with CreateConnection method. If user wants to use other connections (not main and not default) he has to pass this connection explicitly as parameter of a method which he wants to use. User can additionally create any number of connections. Default connection can be only one per thread. Please note default connections works correctly if user uses Thread objects for multitasking programming. If user uses ConnectionPool or uses Task objects for multitasking programming this mode may lead to wrong behaviour of a programm. To avoid this problem user has to manually dispose default conection (if he uses it) in the end of the code which executes in the thread. - ConnectionAsgmtType.UseMain Email client uses main connection for all operations from multiple threads. Main connection is connection which is created in the same time like email client. User cann't create default connections. User can create connections not linked with threads (not default connections) with CreateConnection method. If user wants to use other connections (not main and not default) he has to pass this connection explicitly as parameter of a method which he wants to use. User can additionally create any number of connections. - ConnectionAsgmtType.UseDefault Email client uses implicitly only default connections for all operations from multiple threads. Main connection is not used in this mode. If default connection hasn't been created for some thread (first invocation of email client method), email client creates default connection implicitly for thread before first operation is executed. User can't create default connections for threads with CreateConnection method because they are created automatically. When default connection for thread is created, it's used implicitly for all methods of email client which are invoked in this thread.read. User also can create connections not linked with threads (not default connections) with CreateConnection method. If user wants to use other connections (not main and not default) he has to pass this connection explicitly as parameter of a method which he wants to use. User can additionally create any number of connections. Default connection can be only one per thread. Please note default connections works correctly if user uses Thread objects for multitasking programming. If user uses ConnectionPool or uses Task objects for multitasking programming this mode may lead to wrong behaviour of a programm. To avoid this problem user has to manually dispose default conection in the end of the code which executes in the thread.
public void setConnectionAsgmtMode(int value)
Gets or sets value which defines mode of connection allocation in multiple threads environment There are folowing connection types: - Main connection is connection created and disposed together with mail client.It can't be created or disposed manually. - Default connection is connection default for some thread. If default connection exists and ConnectionAsgmtMode allow, all methods of email client executed in this thread will be implicitly use this connection. Only one default connection can be exist per thread. It can be created manually or automatically. It depends on EmailClient.ConnectionAsgmtMode property. These connections can be created manually with EmailClient.CreateConnection(createAsDefaultConnection = true) method. If default connection does not used(depends on connection allocation mode), main connection used implicitly instead of it. - Independent connections are connections that are not linked to threads.They can be created manually and has to be used explicitly as method parameter. These connections can be created manually with EmailClient.CreateConnection() method or EmailClient.CreateConnection(createAsDefaultConnection = false) method. There are folowing connection allocation types: - ConnectionAsgmtType.UseMainOrDefault This mode uses by default in email clients. Email client uses main connection for all operations from multiple threads if default connection hasn't been created, or connection hasnt been passed as method parameter explicitly. Main connection is connection which is created in the same time like email client. User can create default connections for threads with CreateConnection method. If default connection for thread is created, it's used implicitly for all methods of email client which are invoked in this thread. If default connection for thread is not created, main connection is used for all methods of email client which are invoked in this thread. User also can create connections not linked with threads (not default connections) with CreateConnection method. If user wants to use other connections (not main and not default) he has to pass this connection explicitly as parameter of a method which he wants to use. User can additionally create any number of connections. Default connection can be only one per thread. Please note default connections works correctly if user uses Thread objects for multitasking programming. If user uses ConnectionPool or uses Task objects for multitasking programming this mode may lead to wrong behaviour of a programm. To avoid this problem user has to manually dispose default conection (if he uses it) in the end of the code which executes in the thread. - ConnectionAsgmtType.UseMain Email client uses main connection for all operations from multiple threads. Main connection is connection which is created in the same time like email client. User cann't create default connections. User can create connections not linked with threads (not default connections) with CreateConnection method. If user wants to use other connections (not main and not default) he has to pass this connection explicitly as parameter of a method which he wants to use. User can additionally create any number of connections. - ConnectionAsgmtType.UseDefault Email client uses implicitly only default connections for all operations from multiple threads. Main connection is not used in this mode. If default connection hasn't been created for some thread (first invocation of email client method), email client creates default connection implicitly for thread before first operation is executed. User can't create default connections for threads with CreateConnection method because they are created automatically. When default connection for thread is created, it's used implicitly for all methods of email client which are invoked in this thread.read. User also can create connections not linked with threads (not default connections) with CreateConnection method. If user wants to use other connections (not main and not default) he has to pass this connection explicitly as parameter of a method which he wants to use. User can additionally create any number of connections. Default connection can be only one per thread. Please note default connections works correctly if user uses Thread objects for multitasking programming. If user uses ConnectionPool or uses Task objects for multitasking programming this mode may lead to wrong behaviour of a programm. To avoid this problem user has to manually dispose default conection in the end of the code which executes in the thread.
@Deprecated public int getUseMultyConnection()
Gets or sets value which indicates if client has to use multiple connections for heavy loaded operations. Please note, using of this mode not necessary has to lead to performance increasing.
@Deprecated public void setUseMultyConnection(int value)
Gets or sets value which indicates if client has to use multiple connections for heavy loaded operations. Please note, using of this mode not necessary has to lead to performance increasing.
public int getUseMultiConnection()
Gets or sets value which indicates if client has to use multiple connections for heavy loaded operations. Please note, using of this mode not necessary has to lead to performance increasing.
public void setUseMultiConnection(int value)
Gets or sets value which indicates if client has to use multiple connections for heavy loaded operations. Please note, using of this mode not necessary has to lead to performance increasing.
public int getConnectionsQuantity()
Gets or sets quantity of connections in multy-connection mode
public void setConnectionsQuantity(int value)
Gets or sets quantity of connections in multy-connection mode