Show / Hide Table of Contents

Class SoMail

Helper class for sending and receiving e-mails

Inheritance
object
SoMail
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Mail
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public static class SoMail

Properties

CanRead

Get if the currently logged in user can read e-mails and access the message store.

Declaration
public static bool CanRead { get; }
Property Value
Type Description
bool

CanSend

Get if the currently logged in user can send e-mails

Declaration
public static bool CanSend { get; }
Property Value
Type Description
bool

Methods

BeginReadAsync(SoMailFolder, string, string, string, bool, CancellationToken)

Obtain reference to session for incoming mail server/message store (i.e. IMAP).

Declaration
public static Task<MessageStoreSession> BeginReadAsync(SoMailFolder folder, string server, string userName, string password, bool useSSL, CancellationToken cancellationToken)
Parameters
Type Name Description
SoMailFolder folder

Folder to set active

string server

Name of outgoing (i.e. SMTP) 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<MessageStoreSession>

Disposable object holding session to incoming mail server/message store (i.e. IMAP).

BeginReadAsync(SoMailFolder, string, string, string, CancellationToken)

Obtain reference to session for incoming mail server/message store (i.e. IMAP).

Declaration
public static Task<MessageStoreSession> BeginReadAsync(SoMailFolder folder, string server, string userName, string password, CancellationToken cancellationToken)
Parameters
Type Name Description
SoMailFolder folder

Folder to set active

string server

Name of outgoing (i.e. SMTP) 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<MessageStoreSession>

Disposable object holding session to incoming mail server/message store (i.e. IMAP).

BeginReadAsync(SoMailFolder, CancellationToken)

Obtain reference to session for incoming mail server/message store (i.e. IMAP).

Declaration
public static Task<MessageStoreSession> BeginReadAsync(SoMailFolder folder, CancellationToken cancellationToken)
Parameters
Type Name Description
SoMailFolder folder

Folder to set active

CancellationToken cancellationToken
Returns
Type Description
Task<MessageStoreSession>

Disposable object holding session to incoming mail server/message store (i.e. IMAP).

BeginReadAsync(string, string, string, string, bool, bool, CancellationToken)

Obtain reference to session for incoming mail server/message store (i.e. IMAP).

Declaration
public static Task<MessageStoreSession> BeginReadAsync(string folderName, string server, string userName, string password, bool useSSL, bool readOnly, CancellationToken cancellationToken)
Parameters
Type Name Description
string folderName

Full path and name of folder to set active

string server

Name of outgoing (i.e. SMTP) 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
bool readOnly

Should folder be selected as readonly

CancellationToken cancellationToken
Returns
Type Description
Task<MessageStoreSession>

Disposable object holding session to incoming mail server/message store (i.e. IMAP).

BeginReadAsync(string, string, string, string, bool, CancellationToken)

Obtain reference to session for incoming mail server/message store (i.e. IMAP).

Declaration
public static Task<MessageStoreSession> BeginReadAsync(string folderName, string server, string userName, string password, bool useSSL, CancellationToken cancellationToken)
Parameters
Type Name Description
string folderName

Full path and name of folder to set active

string server

Name of outgoing (i.e. SMTP) 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
CancellationToken cancellationToken
Returns
Type Description
Task<MessageStoreSession>

Disposable object holding session to incoming mail server/message store (i.e. IMAP).

BeginReadAsync(string, string, string, string, CancellationToken)

Obtain reference to session for incoming mail server/message store (i.e. IMAP).

Declaration
public static Task<MessageStoreSession> BeginReadAsync(string folderName, string server, string userName, string password, CancellationToken cancellationToken)
Parameters
Type Name Description
string folderName

Full path and name of folder to set active

string server

Name of outgoing (i.e. SMTP) 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<MessageStoreSession>

Disposable object holding session to incoming mail server/message store (i.e. IMAP).

BeginSend(string, string, string)

Obtain reference to session for outgoing (i.e. SMTP) mail server.

Declaration
public static OutgoingMailSession BeginSend(string server, string userName, string password)
Parameters
Type Name Description
string server

Name of outgoing (i.e. SMTP) 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

Returns
Type Description
OutgoingMailSession

Disposable object holding session to outgoing (i.e. SMTP) mail server.

BeginSend(string, string, string, bool)

Obtain reference to session for outgoing (i.e. SMTP) mail server.

Declaration
public static OutgoingMailSession BeginSend(string server, string userName, string password, bool useSSL)
Parameters
Type Name Description
string server

Name of outgoing (i.e. SMTP) 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

Should we use a secure connection

Returns
Type Description
OutgoingMailSession

Disposable object holding session to outgoing (i.e. SMTP) mail server.

BeginSendAsync(CancellationToken)

Obtain reference to session for outgoing (i.e. SMTP) mail server according to the current users configuration.

Declaration
public static Task<OutgoingMailSession> BeginSendAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<OutgoingMailSession>

Disposable object holding session to outgoing (i.e. SMTP) mail server.

GetFolderNameAsync(SoMailFolder, CancellationToken)

Get folder name from SuperOffice.CRM.Mail.SoMailFolder

Declaration
public static Task<string> GetFolderNameAsync(SoMailFolder folder, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SoMailFolder folder

Folder to find name for.

CancellationToken cancellationToken
Returns
Type Description
Task<string>

Name of folder.

GetLoginCredentialsAsync(int, string, CancellationToken)

Get login info for specified type. Ex: "imap", "smtp" for a specified associate

Declaration
public static Task<SoMailCredentials> GetLoginCredentialsAsync(int associateId, string type, CancellationToken cancellationToken)
Parameters
Type Name Description
int associateId
string type
CancellationToken cancellationToken
Returns
Type Description
Task<SoMailCredentials>

GetLoginCredentialsAsync(string, CancellationToken)

Get login info for specified type. Ex: "imap", "smtp".

Declaration
public static Task<SoMailCredentials> GetLoginCredentialsAsync(string type, CancellationToken cancellationToken)
Parameters
Type Name Description
string type
CancellationToken cancellationToken
Returns
Type Description
Task<SoMailCredentials>

GetMailReaderAsync(CancellationToken)

Helper class for sending and receiving e-mails

Declaration
public static Task<ISoIncomingMailInterface> GetMailReaderAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ISoIncomingMailInterface>

GetMailSenderAsync(CancellationToken)

Helper class for sending and receiving e-mails

Declaration
public static Task<ISoOutgoingMailInterface> GetMailSenderAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ISoOutgoingMailInterface>

LoginIncomingAsync(string, string, string, bool, string, bool, bool, CancellationToken)

Log in to an incoming mail server

Declaration
public static Task<ISoIncomingMailInterface> LoginIncomingAsync(string server, string username, string password, bool useSSL, string folder, bool readOnly, bool createFolderIfNotFound, CancellationToken cancellationToken)
Parameters
Type Name Description
string server

DNS or IP to mailserver. Port may be appended by suffixing with ':port'

string username

Account username

string password

Account password

bool useSSL

Use secure connection

string folder

Name of folder to set as active

bool readOnly

Should folder be selected as read only

bool createFolderIfNotFound

Create the folder if it does not exist

CancellationToken cancellationToken
Returns
Type Description
Task<ISoIncomingMailInterface>

Instance of the created mail connection

LoginIncomingExtendedAsync(string, string, int, string, string, string, bool, bool, CancellationToken)

Log in to an incoming mail server

Declaration
public static Task<ISoIncomingMailInterface> LoginIncomingExtendedAsync(string protocol, string server, int port, string username, string password, string folder, bool readOnly, bool createFolderIfNotFound, CancellationToken cancellationToken)
Parameters
Type Name Description
string protocol
string server

DNS or IP to mailserver. Port may be appended by suffixing with ':port'

int port
string username

Account username

string password

Account password

string folder

Name of folder to set as active

bool readOnly

Should folder be selected as read only

bool createFolderIfNotFound

Create the folder if it does not exist

CancellationToken cancellationToken
Returns
Type Description
Task<ISoIncomingMailInterface>

Instance of the created mail connection

LoginOutgoingAsync(string, string, string, bool, CancellationToken)

Log in to an outgoing mail server

Declaration
public static Task<ISoOutgoingMailInterface> LoginOutgoingAsync(string server, string username, string password, bool useSSL, CancellationToken cancellationToken)
Parameters
Type Name Description
string server

DNS or IP to mailserver. Port may be appended by suffixing with ':port'

string username

Account username

string password

Account password

bool useSSL

Use secure connection

CancellationToken cancellationToken
Returns
Type Description
Task<ISoOutgoingMailInterface>

Instance of the created mail connection

LoginOutgoingExtendedAsync(string, string, int, string, string, CancellationToken)

Log in to an outgoing mail server

Declaration
public static Task<ISoOutgoingMailInterface> LoginOutgoingExtendedAsync(string protocol, string server, int port, string username, string password, CancellationToken cancellationToken)
Parameters
Type Name Description
string protocol
string server

DNS or IP to mailserver. Port may be appended by suffixing with ':port'

int port
string username

Account username

string password

Account password

CancellationToken cancellationToken
Returns
Type Description
Task<ISoOutgoingMailInterface>

Instance of the created mail connection

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top