Represents the client that creates server connection by using the host credentials. More...

Inherits IDisposable.

Inherited by Aspose::Email::Clients::Imap::ImapClient, Aspose::Email::Clients::Pop3::Pop3Client, and Aspose::Email::Clients::Smtp::SmtpClient.

Public Member Functions

bool get_EnableLogger ()
 Gets value which allows enable/disable logger More...
 
void set_EnableLogger (bool value)
 Sets value which allows enable/disable logger More...
 
System::String get_LogFileName ()
 Gets log file name More...
 
void set_LogFileName (System::String value)
 Sets log file name More...
 
bool get_UseDateInLogFileName () const
 Gets value which indicates if date has to be used in log file name. More...
 
void set_UseDateInLogFileName (bool value)
 Sets value which indicates if date has to be used in log file name. More...
 
virtual System::SharedPtr< Aspose::Email::Tools::Logging::Loggerget_Logger ()
 
virtual void set_Logger (System::SharedPtr< Aspose::Email::Tools::Logging::Logger > value)
 
virtual System::SharedPtr< System::Text::Encoding > get_DefaultEncoding ()
 Gets default encoding for email client More...
 
virtual void set_DefaultEncoding (System::SharedPtr< System::Text::Encoding > value)
 Sets default encoding for email client More...
 
virtual Base::EncryptionProtocols get_SupportedEncryption ()
 Defines the versions of SSL/TLS encryption protocols to be used. PLEASE PAY YOUR ATTENTION, you may set only those versions of protocol, which are supported by .net framework. IF SOME VERSIONS OF PROTOCOL ARE NOT SUPPORTED BY YOUR CURRENT VERSION OF .NET FRAMEWORK, THEY WILL BE IGNORED AND SKIPPED. IT MAY LEAD TO DOWNGRADE TLS SECURITY LEVEL. IN THIS CASE EXCEPTION WON'T BE GENERATED!!! Please, see EncryptionProtocols documentation for more details. Please use SetSupportedEncryptionUnsafe method if you want to set the encryption protocols without any compatibility checks. Default value is: Tls | Tls11 | Tls12 | Tls13 (in case if your current version of .net framework supports these versions of TLS) More...
 
virtual void set_SupportedEncryption (Base::EncryptionProtocols value)
 Defines the versions of SSL/TLS encryption protocols to be used. PLEASE PAY YOUR ATTENTION, you may set only those versions of protocol, which are supported by .net framework. IF SOME VERSIONS OF PROTOCOL ARE NOT SUPPORTED BY YOUR CURRENT VERSION OF .NET FRAMEWORK, THEY WILL BE IGNORED AND SKIPPED. IT MAY LEAD TO DOWNGRADE TLS SECURITY LEVEL. IN THIS CASE EXCEPTION WON'T BE GENERATED!!! Please, see EncryptionProtocols documentation for more details. Please use SetSupportedEncryptionUnsafe method if you want to set the encryption protocols without any compatibility checks. Default value is: Tls | Tls11 | Tls12 | Tls13 (in case if your current version of .net framework supports these versions of TLS) More...
 
virtual System::SharedPtr< System::Security::Cryptography::X509Certificates::X509CertificateCollection > get_ClientCertificates ()
 Contains collection of clients certificates More...
 
virtual System::SharedPtr< PipeliningStatusget_UsePipelining ()
 Gets object which indicates whether the pipelining mode is enabled. More...
 
virtual void set_UsePipelining (System::SharedPtr< PipeliningStatus > value)
 Sets object which indicates whether the pipelining mode is enabled. More...
 
virtual System::String get_Host ()
 Gets the host name. More...
 
virtual void set_Host (System::String value)
 Sets the host name. More...
 
virtual int32_t get_DefaultPort ()
 Gets default port for client More...
 
virtual int32_t get_Port ()
 Gets the port. More...
 
virtual void set_Port (int32_t value)
 Sets the port. More...
 
virtual Aspose::Email::Clients::SecurityOptions get_SecurityOptions ()
 Security mode for a mail client More...
 
virtual void set_SecurityOptions (Aspose::Email::Clients::SecurityOptions value)
 Security mode for a mail client More...
 
virtual bool get_UseAuthentication ()
 Indicates whether authentication is used. More...
 
virtual void set_UseAuthentication (bool value)
 Indicates whether authentication is used. More...
 
virtual int32_t get_ConnectionCheckupPeriod ()
 Period of connection checking up in milliseconds. Default value is 5 min. More...
 
virtual void set_ConnectionCheckupPeriod (int32_t value)
 Period of connection checking up in milliseconds. Default value is 5 min. More...
 
virtual bool get_UseDefaultCredentials ()
 Gets a Boolean value that controls whether the DefaultCredentials are sent with requests. This option is used with NTLM authentication ONLY! More...
 
virtual void set_UseDefaultCredentials (bool value)
 Sets a Boolean value that controls whether the DefaultCredentials are sent with requests. This option is used with NTLM authentication ONLY! More...
 
virtual System::SharedPtr< Aspose::Email::Clients::Proxyget_Proxy ()
 Gets proxy for the client More...
 
virtual void set_Proxy (System::SharedPtr< Aspose::Email::Clients::Proxy > value)
 Sets proxy for the client More...
 
int32_t get_Timeout ()
 Gets the timeout for mail operations More...
 
void set_Timeout (int32_t value)
 Sets the timeout for mail operations More...
 
int32_t get_GreetingTimeout ()
 Gets the greeting timeout that is used when establishing a connection. Please note, greeting timeout can't be infinite. More...
 
void set_GreetingTimeout (int32_t value)
 Sets the greeting timeout that is used when establishing a connection. Please note, greeting timeout can't be infinite. More...
 
System::SharedPtr< System::Net::ICredentialsByHost > get_Credentials ()
 
void set_Credentials (System::SharedPtr< System::Net::ICredentialsByHost > value)
 
virtual System::String get_Password ()
 Gets the password. Password limitations are defined by server implementation, which client connects. More...
 
virtual void set_Password (System::String value)
 Sets the password. Password limitations are defined by server implementation, which client connects. More...
 
virtual System::String get_AccessToken ()
 Gets the access token. More...
 
virtual void set_AccessToken (System::String value)
 Sets the access token. More...
 
System::SharedPtr< ITokenProviderget_TokenProvider () const
 Gets TokenProvider allowing to retrieve access token. More...
 
void set_TokenProvider (System::SharedPtr< ITokenProvider > value)
 Sets TokenProvider allowing to retrieve access token. More...
 
virtual System::String get_Username ()
 Gets the username. More...
 
virtual void set_Username (System::String value)
 Sets the username. More...
 
Aspose::Email::Clients::ConnectionState get_ConnectionState ()
 Gets the current state of the connection. More...
 
System::SharedPtr< Aspose::Email::Clients::ConnectionPool > get_ConnectionPool () const
 Gets connection pool for the client More...
 
void set_ConnectionPool (System::SharedPtr< Aspose::Email::Clients::ConnectionPool > value)
 Sets connection pool for the client More...
 
virtual System::SharedPtr< IConnectionget_CurrentConnection ()
 Gets current connection according to ConnectionAsgmtMode option More...
 
virtual ConnectionAsgmtType get_ConnectionAsgmtMode ()
 Gets value which defines mode of connection allocation in multiple threads environment More...
 
virtual void set_ConnectionAsgmtMode (ConnectionAsgmtType value)
 Sets value which defines mode of connection allocation in multiple threads environment More...
 
virtual MultiConnectionMode get_UseMultiConnection ()
 Gets 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. More...
 
virtual void set_UseMultiConnection (MultiConnectionMode value)
 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. More...
 
virtual int32_t get_ConnectionsQuantity ()
 Gets quantity of connections in multy-connection mode More...
 
virtual void set_ConnectionsQuantity (int32_t value)
 Sets quantity of connections in multy-connection mode More...
 
void InitializeConnectionPool ()
 
void ResetLogSettings ()
 Resets logging settings to default. More...
 
void initializeLogger ()
 
void SetSupportedEncryptionUnsafe (Base::EncryptionProtocols value)
 Defines the versions of SSL/TLS encryption protocols to be used. This method is not safe and sets the encryption protocols without any compatibility checks. Use SupportedEncryption property to safely set only protocols that definitely supported by .net framework. Please note, if your current .net framework does not support this level of security, an exception will be thrown when trying to establish a connection to the server. More...
 
void SetCredentials ()
 
virtual System::ArrayPtr< System::String > GetCapabilities ()
 
void CancelAsyncOperation (System::SharedPtr< System::IAsyncResult > asyncResult)
 Cancels asynchronous operation. This method is used only with APM operations also known as Begin/End methods. Please do not use this method with TAP operations! More...
 
virtual void Noop ()=0
 'No operation' command More...
 
virtual bool ValidateCredentials ()=0
 Checks if the credentials are valid More...
 
virtual void Noop (System::SharedPtr< IConnection > connection)=0
 'No operation' command More...
 
virtual void Noop (System::SharedPtr< Connection > connection, int32_t timeout)=0
 'No operation' command More...
 
virtual void ConnectionFinalize (System::SharedPtr< System::Object > sender, System::SharedPtr< Base::ConnectionEventArgs > args)
 Performs finalization operation for specified connection More...
 
System::SharedPtr< System::Object > EndGroupOperation (System::SharedPtr< System::IAsyncResult > asyncResult)
 Waits for the pending asynchronous operation to complete. More...
 
void Dispose () override
 Finalizes all operations with a server. More...
 
virtual System::SharedPtr< IConnectionCreateConnection ()
 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. More...
 
virtual System::SharedPtr< IConnectionCreateConnection (bool createAsDefaultConnection)
 Creates new (default or independent) connection for operations. Please see more in documentation for EmailClient.ConnectionAsgmtMode property. More...
 

Public Attributes

System::SharedPtr< System::Object > loggerSyncObj
 
System::SharedPtr< Aspose::Email::Tools::Logging::Loggerlogger
 
System::String password
 
System::String username
 
System::String accessToken
 
System::SharedPtr< ITokenProvidertokenProvider
 
System::SharedPtr< Aspose::Email::Clients::ConnectionPool > connectionPool
 
System::String clientType
 

Static Public Attributes

static System::SharedPtr< System::Object > logManagerSyncObj
 

Protected Member Functions

 EmailClient (System::String type)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, Aspose::Email::Clients::SecurityOptions securityOptions)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, System::String username, System::String password)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, System::String username, System::String password, Aspose::Email::Clients::SecurityOptions securityOptions)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, System::String username, System::String authInfo, bool useOAuth)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, System::String username, System::String authInfo, bool useOAuth, Aspose::Email::Clients::SecurityOptions securityOptions)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, System::String username, System::SharedPtr< ITokenProvider > tokenProvider)
 Initializes a new instance of the EmailClient class. More...
 
 EmailClient (System::String type, System::String host, int32_t port, System::String username, System::SharedPtr< ITokenProvider > tokenProvider, Aspose::Email::Clients::SecurityOptions securityOptions)
 Initializes a new instance of the EmailClient class. More...
 
virtual void Dispose (bool disposing)
 Finalizes all operations with a server. More...
 
virtual ~EmailClient ()
 

Friends

class Aspose::Email::Clients::Base::BaseProtocolCommand
 
class Aspose::Email::Clients::Connection
 
class Aspose::Email::Clients::ConnectionPool
 
class Aspose::Email::Clients::Imap::ImapClient
 
class Aspose::Email::Clients::Pop3::Pop3Client
 
class Aspose::Email::Clients::Smtp::SmtpClient
 

Detailed Description

Represents the client that creates server connection by using the host credentials.

Constructor & Destructor Documentation

◆ EmailClient() [1/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type)
protected

Initializes a new instance of the EmailClient class.

◆ EmailClient() [2/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host name.
portThe port number.

◆ EmailClient() [3/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
Aspose::Email::Clients::SecurityOptions  securityOptions 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host name.
portThe port number.
securityOptionsSecurity mode for a mail client

◆ EmailClient() [4/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
System::String  username,
System::String  password 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host name.
portThe port number.
usernameThe username.
passwordThe account password. Password limitations are defined by server implementation, which the client connects.

◆ EmailClient() [5/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
System::String  username,
System::String  password,
Aspose::Email::Clients::SecurityOptions  securityOptions 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host name.
portThe port number.
usernameThe username.
passwordThe account password. Password limitations are defined by server implementation, which the client connects.
securityOptionsSecurity mode for a mail client

◆ EmailClient() [6/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
System::String  username,
System::String  authInfo,
bool  useOAuth 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host.
portThe port.
usernameThe username.
authInfoA string representation of the user password or the access token. AuthInfo limitations are defined by server implementation, which the client connects.
useOAuthDefines whether OAuth is used to login to the server

◆ EmailClient() [7/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
System::String  username,
System::String  authInfo,
bool  useOAuth,
Aspose::Email::Clients::SecurityOptions  securityOptions 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host.
portThe port.
usernameThe username.
authInfoA string representation of the user password or the access token.
useOAuthDefines whether OAuth is used to login to the server
securityOptionsSecurity mode for a mail client

◆ EmailClient() [8/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
System::String  username,
System::SharedPtr< ITokenProvider tokenProvider 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host.
portThe port.
usernameThe username.
tokenProviderTokenProvider allowing to retrieve access token.

◆ EmailClient() [9/9]

Aspose::Email::Clients::EmailClient::EmailClient ( System::String  type,
System::String  host,
int32_t  port,
System::String  username,
System::SharedPtr< ITokenProvider tokenProvider,
Aspose::Email::Clients::SecurityOptions  securityOptions 
)
protected

Initializes a new instance of the EmailClient class.

Parameters
hostThe host.
portThe port.
usernameThe username.
tokenProviderTokenProvider allowing to retrieve access token.
securityOptions

◆ ~EmailClient()

virtual Aspose::Email::Clients::EmailClient::~EmailClient ( )
protectedvirtual

Member Function Documentation

◆ CancelAsyncOperation()

void Aspose::Email::Clients::EmailClient::CancelAsyncOperation ( System::SharedPtr< System::IAsyncResult >  asyncResult)

Cancels asynchronous operation. This method is used only with APM operations also known as Begin/End methods. Please do not use this method with TAP operations!

Deprecated:
This method is murked as obsolete and will be removed soon.
Parameters
asyncResultDefines asynchronous operation to cancel.

◆ ConnectionFinalize()

virtual void Aspose::Email::Clients::EmailClient::ConnectionFinalize ( System::SharedPtr< System::Object >  sender,
System::SharedPtr< Base::ConnectionEventArgs >  args 
)
virtual

Performs finalization operation for specified connection

Parameters
senderThe source of the event.
argsAn ConnectionManagerEventArgs that contains the event data.

◆ CreateConnection() [1/2]

virtual System::SharedPtr<IConnection> Aspose::Email::Clients::EmailClient::CreateConnection ( )
virtual

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.

Returns
Returns connection object

◆ CreateConnection() [2/2]

virtual System::SharedPtr<IConnection> Aspose::Email::Clients::EmailClient::CreateConnection ( bool  createAsDefaultConnection)
virtual

Creates new (default or independent) connection for operations. Please see more in documentation for EmailClient.ConnectionAsgmtMode property.

Parameters
createAsDefaultConnectionIndicates if connection has to be created as default for current thread
Returns
Returns connection object

◆ Dispose() [1/2]

void Aspose::Email::Clients::EmailClient::Dispose ( )
override

Finalizes all operations with a server.

◆ Dispose() [2/2]

virtual void Aspose::Email::Clients::EmailClient::Dispose ( bool  disposing)
protectedvirtual

Finalizes all operations with a server.

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

◆ EndGroupOperation()

System::SharedPtr<System::Object> Aspose::Email::Clients::EmailClient::EndGroupOperation ( System::SharedPtr< System::IAsyncResult >  asyncResult)

Waits for the pending asynchronous operation to complete.

Parameters
asyncResultThe reference to the pending asynchronous request to wait for.

◆ get_AccessToken()

virtual System::String Aspose::Email::Clients::EmailClient::get_AccessToken ( )
virtual

Gets the access token.

The string that represents access token.

◆ get_ClientCertificates()

virtual System::SharedPtr<System::Security::Cryptography::X509Certificates::X509CertificateCollection> Aspose::Email::Clients::EmailClient::get_ClientCertificates ( )
virtual

Contains collection of clients certificates

◆ get_ConnectionAsgmtMode()

virtual ConnectionAsgmtType Aspose::Email::Clients::EmailClient::get_ConnectionAsgmtMode ( )
virtual

Gets 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.

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.

◆ get_ConnectionCheckupPeriod()

virtual int32_t Aspose::Email::Clients::EmailClient::get_ConnectionCheckupPeriod ( )
virtual

Period of connection checking up in milliseconds. Default value is 5 min.

◆ get_ConnectionPool()

System::SharedPtr<Aspose::Email::Clients::ConnectionPool> Aspose::Email::Clients::EmailClient::get_ConnectionPool ( ) const

Gets connection pool for the client

◆ get_ConnectionsQuantity()

virtual int32_t Aspose::Email::Clients::EmailClient::get_ConnectionsQuantity ( )
virtual

Gets quantity of connections in multy-connection mode

◆ get_ConnectionState()

Aspose::Email::Clients::ConnectionState Aspose::Email::Clients::EmailClient::get_ConnectionState ( )

Gets the current state of the connection.

◆ get_Credentials()

System::SharedPtr<System::Net::ICredentialsByHost> Aspose::Email::Clients::EmailClient::get_Credentials ( )

◆ get_CurrentConnection()

virtual System::SharedPtr<IConnection> Aspose::Email::Clients::EmailClient::get_CurrentConnection ( )
virtual

Gets current connection according to ConnectionAsgmtMode option

◆ get_DefaultEncoding()

virtual System::SharedPtr<System::Text::Encoding> Aspose::Email::Clients::EmailClient::get_DefaultEncoding ( )
virtual

Gets default encoding for email client

◆ get_DefaultPort()

virtual int32_t Aspose::Email::Clients::EmailClient::get_DefaultPort ( )
virtual

◆ get_EnableLogger()

bool Aspose::Email::Clients::EmailClient::get_EnableLogger ( )

Gets value which allows enable/disable logger

◆ get_GreetingTimeout()

int32_t Aspose::Email::Clients::EmailClient::get_GreetingTimeout ( )

Gets the greeting timeout that is used when establishing a connection. Please note, greeting timeout can't be infinite.

Email clients may execute enough long operations. To limit the time of operations users have to use EmailClient::Timeout property. Values for this property have to have long intervals to not prevent long-time operations. But in some cases, if EmailClient will use only Timeout property connection establishing may take a long time. For instance, the mail client may use the automatic mode to connection establishing. In this mode, the email client goes through all possible connection parameters until the connection is established. SMTP, IMAP, and POP3 servers in case of correct connection establishing send greeting string to the client. Servers may use implicit or explicit (START TLS) SSL/TLS connection initiation. If connection mode is mismatched (for instance, the server waits for an implicit SSL connection but the client tries to establish a non-secured or explicit SSL connection), the server won't send a greeting string. In this case, the user will wait a long time until the timeout reaches a greeting string, and the client goes to the next connection option. To avoid this problem, the GreetingTimeout property has been introduced. This property allows you to set the timeout for greeting string, and reduce the time of automatic connection establishment.

The greeting timeout in milliseconds

◆ get_Host()

virtual System::String Aspose::Email::Clients::EmailClient::get_Host ( )
virtual

Gets the host name.

The host name.

◆ get_LogFileName()

System::String Aspose::Email::Clients::EmailClient::get_LogFileName ( )

Gets log file name

◆ get_Logger()

virtual System::SharedPtr<Aspose::Email::Tools::Logging::Logger> Aspose::Email::Clients::EmailClient::get_Logger ( )
virtual

◆ get_Password()

virtual System::String Aspose::Email::Clients::EmailClient::get_Password ( )
virtual

Gets the password. Password limitations are defined by server implementation, which client connects.

The string that represents the password.

◆ get_Port()

virtual int32_t Aspose::Email::Clients::EmailClient::get_Port ( )
virtual

Gets the port.

The port number.

◆ get_Proxy()

virtual System::SharedPtr<Aspose::Email::Clients::Proxy> Aspose::Email::Clients::EmailClient::get_Proxy ( )
virtual

Gets proxy for the client

◆ get_SecurityOptions()

virtual Aspose::Email::Clients::SecurityOptions Aspose::Email::Clients::EmailClient::get_SecurityOptions ( )
virtual

Security mode for a mail client

◆ get_SupportedEncryption()

virtual Base::EncryptionProtocols Aspose::Email::Clients::EmailClient::get_SupportedEncryption ( )
virtual

Defines the versions of SSL/TLS encryption protocols to be used. PLEASE PAY YOUR ATTENTION, you may set only those versions of protocol, which are supported by .net framework. IF SOME VERSIONS OF PROTOCOL ARE NOT SUPPORTED BY YOUR CURRENT VERSION OF .NET FRAMEWORK, THEY WILL BE IGNORED AND SKIPPED. IT MAY LEAD TO DOWNGRADE TLS SECURITY LEVEL. IN THIS CASE EXCEPTION WON'T BE GENERATED!!! Please, see EncryptionProtocols documentation for more details. Please use SetSupportedEncryptionUnsafe method if you want to set the encryption protocols without any compatibility checks. Default value is: Tls | Tls11 | Tls12 | Tls13 (in case if your current version of .net framework supports these versions of TLS)

◆ get_Timeout()

int32_t Aspose::Email::Clients::EmailClient::get_Timeout ( )

Gets the timeout for mail operations

The timeout in milliseconds

◆ get_TokenProvider()

System::SharedPtr<ITokenProvider> Aspose::Email::Clients::EmailClient::get_TokenProvider ( ) const

Gets TokenProvider allowing to retrieve access token.

◆ get_UseAuthentication()

virtual bool Aspose::Email::Clients::EmailClient::get_UseAuthentication ( )
virtual

Indicates whether authentication is used.

◆ get_UseDateInLogFileName()

bool Aspose::Email::Clients::EmailClient::get_UseDateInLogFileName ( ) const

Gets value which indicates if date has to be used in log file name.

◆ get_UseDefaultCredentials()

virtual bool Aspose::Email::Clients::EmailClient::get_UseDefaultCredentials ( )
virtual

Gets a Boolean value that controls whether the DefaultCredentials are sent with requests. This option is used with NTLM authentication ONLY!

Reimplemented in Aspose::Email::Clients::Smtp::SmtpClient.

◆ get_UseMultiConnection()

virtual MultiConnectionMode Aspose::Email::Clients::EmailClient::get_UseMultiConnection ( )
virtual

Gets 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.

◆ get_UsePipelining()

virtual System::SharedPtr<PipeliningStatus> Aspose::Email::Clients::EmailClient::get_UsePipelining ( )
virtual

Gets object which indicates whether the pipelining mode is enabled.

◆ get_Username()

virtual System::String Aspose::Email::Clients::EmailClient::get_Username ( )
virtual

Gets the username.

The username string.

◆ GetCapabilities()

virtual System::ArrayPtr<System::String> Aspose::Email::Clients::EmailClient::GetCapabilities ( )
virtual

◆ InitializeConnectionPool()

void Aspose::Email::Clients::EmailClient::InitializeConnectionPool ( )

◆ initializeLogger()

void Aspose::Email::Clients::EmailClient::initializeLogger ( )

◆ Noop() [1/3]

virtual void Aspose::Email::Clients::EmailClient::Noop ( )
pure virtual

◆ Noop() [2/3]

virtual void Aspose::Email::Clients::EmailClient::Noop ( System::SharedPtr< Connection >  connection,
int32_t  timeout 
)
pure virtual

'No operation' command

Parameters
connectionConnection to a server
timeouttimeout of a command

Implemented in Aspose::Email::Clients::Smtp::SmtpClient, Aspose::Email::Clients::Pop3::Pop3Client, and Aspose::Email::Clients::Imap::ImapClient.

◆ Noop() [3/3]

virtual void Aspose::Email::Clients::EmailClient::Noop ( System::SharedPtr< IConnection connection)
pure virtual

'No operation' command

Parameters
connectionConnection to a server

Implemented in Aspose::Email::Clients::Smtp::SmtpClient, Aspose::Email::Clients::Pop3::Pop3Client, and Aspose::Email::Clients::Imap::ImapClient.

◆ ResetLogSettings()

void Aspose::Email::Clients::EmailClient::ResetLogSettings ( )

Resets logging settings to default.

◆ set_AccessToken()

virtual void Aspose::Email::Clients::EmailClient::set_AccessToken ( System::String  value)
virtual

Sets the access token.

The string that represents access token.

◆ set_ConnectionAsgmtMode()

virtual void Aspose::Email::Clients::EmailClient::set_ConnectionAsgmtMode ( ConnectionAsgmtType  value)
virtual

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.

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.

◆ set_ConnectionCheckupPeriod()

virtual void Aspose::Email::Clients::EmailClient::set_ConnectionCheckupPeriod ( int32_t  value)
virtual

Period of connection checking up in milliseconds. Default value is 5 min.

◆ set_ConnectionPool()

void Aspose::Email::Clients::EmailClient::set_ConnectionPool ( System::SharedPtr< Aspose::Email::Clients::ConnectionPool >  value)

Sets connection pool for the client

◆ set_ConnectionsQuantity()

virtual void Aspose::Email::Clients::EmailClient::set_ConnectionsQuantity ( int32_t  value)
virtual

Sets quantity of connections in multy-connection mode

◆ set_Credentials()

void Aspose::Email::Clients::EmailClient::set_Credentials ( System::SharedPtr< System::Net::ICredentialsByHost >  value)

◆ set_DefaultEncoding()

virtual void Aspose::Email::Clients::EmailClient::set_DefaultEncoding ( System::SharedPtr< System::Text::Encoding >  value)
virtual

Sets default encoding for email client

◆ set_EnableLogger()

void Aspose::Email::Clients::EmailClient::set_EnableLogger ( bool  value)

Sets value which allows enable/disable logger

◆ set_GreetingTimeout()

void Aspose::Email::Clients::EmailClient::set_GreetingTimeout ( int32_t  value)

Sets the greeting timeout that is used when establishing a connection. Please note, greeting timeout can't be infinite.

Email clients may execute enough long operations. To limit the time of operations users have to use EmailClient::Timeout property. Values for this property have to have long intervals to not prevent long-time operations. But in some cases, if EmailClient will use only Timeout property connection establishing may take a long time. For instance, the mail client may use the automatic mode to connection establishing. In this mode, the email client goes through all possible connection parameters until the connection is established. SMTP, IMAP, and POP3 servers in case of correct connection establishing send greeting string to the client. Servers may use implicit or explicit (START TLS) SSL/TLS connection initiation. If connection mode is mismatched (for instance, the server waits for an implicit SSL connection but the client tries to establish a non-secured or explicit SSL connection), the server won't send a greeting string. In this case, the user will wait a long time until the timeout reaches a greeting string, and the client goes to the next connection option. To avoid this problem, the GreetingTimeout property has been introduced. This property allows you to set the timeout for greeting string, and reduce the time of automatic connection establishment.

The greeting timeout in milliseconds

◆ set_Host()

virtual void Aspose::Email::Clients::EmailClient::set_Host ( System::String  value)
virtual

Sets the host name.

The host name.

◆ set_LogFileName()

void Aspose::Email::Clients::EmailClient::set_LogFileName ( System::String  value)

Sets log file name

◆ set_Logger()

virtual void Aspose::Email::Clients::EmailClient::set_Logger ( System::SharedPtr< Aspose::Email::Tools::Logging::Logger value)
virtual

◆ set_Password()

virtual void Aspose::Email::Clients::EmailClient::set_Password ( System::String  value)
virtual

Sets the password. Password limitations are defined by server implementation, which client connects.

The string that represents the password.

◆ set_Port()

virtual void Aspose::Email::Clients::EmailClient::set_Port ( int32_t  value)
virtual

Sets the port.

The port number.

◆ set_Proxy()

virtual void Aspose::Email::Clients::EmailClient::set_Proxy ( System::SharedPtr< Aspose::Email::Clients::Proxy value)
virtual

Sets proxy for the client

◆ set_SecurityOptions()

virtual void Aspose::Email::Clients::EmailClient::set_SecurityOptions ( Aspose::Email::Clients::SecurityOptions  value)
virtual

Security mode for a mail client

◆ set_SupportedEncryption()

virtual void Aspose::Email::Clients::EmailClient::set_SupportedEncryption ( Base::EncryptionProtocols  value)
virtual

Defines the versions of SSL/TLS encryption protocols to be used. PLEASE PAY YOUR ATTENTION, you may set only those versions of protocol, which are supported by .net framework. IF SOME VERSIONS OF PROTOCOL ARE NOT SUPPORTED BY YOUR CURRENT VERSION OF .NET FRAMEWORK, THEY WILL BE IGNORED AND SKIPPED. IT MAY LEAD TO DOWNGRADE TLS SECURITY LEVEL. IN THIS CASE EXCEPTION WON'T BE GENERATED!!! Please, see EncryptionProtocols documentation for more details. Please use SetSupportedEncryptionUnsafe method if you want to set the encryption protocols without any compatibility checks. Default value is: Tls | Tls11 | Tls12 | Tls13 (in case if your current version of .net framework supports these versions of TLS)

◆ set_Timeout()

void Aspose::Email::Clients::EmailClient::set_Timeout ( int32_t  value)

Sets the timeout for mail operations

The timeout in milliseconds

◆ set_TokenProvider()

void Aspose::Email::Clients::EmailClient::set_TokenProvider ( System::SharedPtr< ITokenProvider value)

Sets TokenProvider allowing to retrieve access token.

◆ set_UseAuthentication()

virtual void Aspose::Email::Clients::EmailClient::set_UseAuthentication ( bool  value)
virtual

Indicates whether authentication is used.

◆ set_UseDateInLogFileName()

void Aspose::Email::Clients::EmailClient::set_UseDateInLogFileName ( bool  value)

Sets value which indicates if date has to be used in log file name.

◆ set_UseDefaultCredentials()

virtual void Aspose::Email::Clients::EmailClient::set_UseDefaultCredentials ( bool  value)
virtual

Sets a Boolean value that controls whether the DefaultCredentials are sent with requests. This option is used with NTLM authentication ONLY!

Reimplemented in Aspose::Email::Clients::Smtp::SmtpClient.

◆ set_UseMultiConnection()

virtual void Aspose::Email::Clients::EmailClient::set_UseMultiConnection ( MultiConnectionMode  value)
virtual

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.

◆ set_UsePipelining()

virtual void Aspose::Email::Clients::EmailClient::set_UsePipelining ( System::SharedPtr< PipeliningStatus value)
virtual

Sets object which indicates whether the pipelining mode is enabled.

◆ set_Username()

virtual void Aspose::Email::Clients::EmailClient::set_Username ( System::String  value)
virtual

Sets the username.

The username string.

◆ SetCredentials()

void Aspose::Email::Clients::EmailClient::SetCredentials ( )

◆ SetSupportedEncryptionUnsafe()

void Aspose::Email::Clients::EmailClient::SetSupportedEncryptionUnsafe ( Base::EncryptionProtocols  value)

Defines the versions of SSL/TLS encryption protocols to be used. This method is not safe and sets the encryption protocols without any compatibility checks. Use SupportedEncryption property to safely set only protocols that definitely supported by .net framework. Please note, if your current .net framework does not support this level of security, an exception will be thrown when trying to establish a connection to the server.

◆ ValidateCredentials()

virtual bool Aspose::Email::Clients::EmailClient::ValidateCredentials ( )
pure virtual

Checks if the credentials are valid

Returns
True if authentication was successful, otherwise false.

Implemented in Aspose::Email::Clients::Smtp::SmtpClient, Aspose::Email::Clients::Pop3::Pop3Client, and Aspose::Email::Clients::Imap::ImapClient.

Friends And Related Function Documentation

◆ Aspose::Email::Clients::Base::BaseProtocolCommand

friend class Aspose::Email::Clients::Base::BaseProtocolCommand
friend

◆ Aspose::Email::Clients::Connection

friend class Aspose::Email::Clients::Connection
friend

◆ Aspose::Email::Clients::ConnectionPool

friend class Aspose::Email::Clients::ConnectionPool
friend

◆ Aspose::Email::Clients::Imap::ImapClient

◆ Aspose::Email::Clients::Pop3::Pop3Client

◆ Aspose::Email::Clients::Smtp::SmtpClient

Member Data Documentation

◆ accessToken

System::String Aspose::Email::Clients::EmailClient::accessToken

◆ clientType

System::String Aspose::Email::Clients::EmailClient::clientType

◆ connectionPool

System::SharedPtr<Aspose::Email::Clients::ConnectionPool> Aspose::Email::Clients::EmailClient::connectionPool

◆ logger

System::SharedPtr<Aspose::Email::Tools::Logging::Logger> Aspose::Email::Clients::EmailClient::logger

◆ loggerSyncObj

System::SharedPtr<System::Object> Aspose::Email::Clients::EmailClient::loggerSyncObj

◆ logManagerSyncObj

System::SharedPtr<System::Object> Aspose::Email::Clients::EmailClient::logManagerSyncObj
static

◆ password

System::String Aspose::Email::Clients::EmailClient::password

◆ tokenProvider

System::SharedPtr<ITokenProvider> Aspose::Email::Clients::EmailClient::tokenProvider

◆ username

System::String Aspose::Email::Clients::EmailClient::username