Class MailSession<TMailInterface>
Base class for sessions to mail servers
Implements
Inherited Members
Namespace: SuperOffice.CRM.Mail
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public abstract class MailSession<TMailInterface> : IAsyncDisposable where TMailInterface : class
Type Parameters
Name | Description |
---|---|
TMailInterface |
Constructors
MailSession(string)
Default construction used when no authentication is required.
Declaration
protected MailSession(string server)
Parameters
Type | Name | Description |
---|---|---|
string | server | Name of mail server with optional port. |
MailSession(string, string, string)
Default constructor used when authentication is required.
Declaration
protected MailSession(string server, string userName, string password)
Parameters
Type | Name | Description |
---|---|---|
string | server | Name of mail server with optional port. |
string | userName | User name used to authenticate to the mail server |
string | password | Password used to authenticate to the mail server |
MailSession(string, string, string, bool)
Default constructor used when authentication is required.
Declaration
protected MailSession(string server, string userName, string password, bool useSSL)
Parameters
Type | Name | Description |
---|---|---|
string | server | Name of mail server with optional port. |
string | userName | User name used to authenticate to the mail server |
string | password | Password used to authenticate to the mail server |
bool | useSSL | Use SSL |
Properties
Password
Get password used to authenticate to the mail server
Declaration
protected string Password { get; set; }
Property Value
Type | Description |
---|---|
string |
Server
Get name of server with optional port Server[:Port]
Declaration
public string Server { get; }
Property Value
Type | Description |
---|---|
string |
UseSSL
Should we use SSL
Declaration
public bool UseSSL { get; }
Property Value
Type | Description |
---|---|
bool |
UserName
Get user name used to authenticate to the mail server
Declaration
public string UserName { get; }
Property Value
Type | Description |
---|---|
string |
Methods
DisposeAsync()
Log out from the mail server.
Declaration
public ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
ValueTask |
GetMailInterfaceAsync(CancellationToken)
Get reference to the mail interface. This is null when there are no connections to the mail server.
Declaration
protected Task<TMailInterface> GetMailInterfaceAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<TMailInterface> |
LogoutAsync()
Log out from the mail server.
Declaration
public Task LogoutAsync()
Returns
Type | Description |
---|---|
Task |
ServerLoginAsync(string, string, string, bool, CancellationToken)
Implemented in sub classes to log on to the mail server.
Declaration
protected abstract Task<TMailInterface> ServerLoginAsync(string server, string userName, string password, bool useSSL, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | server | Name of mail server with optional port. |
string | userName | User name used to authenticate to the mail server |
string | password | Password used to authenticate to the mail server |
bool | useSSL | Use SSL |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<TMailInterface> | Instance of interface to the mail plugin. |
ServerLoginAsync(string, string, string, CancellationToken)
Implemented in sub classes to log on to the mail server.
Declaration
protected abstract Task<TMailInterface> ServerLoginAsync(string server, string userName, string password, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | server | Name of mail server with optional port. |
string | userName | User name used to authenticate to the mail server |
string | password | Password used to authenticate to the mail server |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<TMailInterface> | Instance of interface to the mail plugin. |
ServerLogoutAsync()
Implemented in sub classes to log out from the mail server.
Declaration
protected abstract Task ServerLogoutAsync()
Returns
Type | Description |
---|---|
Task |