Class EMailHelper
Helper class for mail tasks
Inherited Members
Namespace: SuperOffice.CRM.Mail
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public static class EMailHelper
Methods
GetEnvelopeSet(SortedDictionary<string, MailEnvelope>, int, int, bool)
Given a sorted list of MailEnvelopes, retrieve a specific set
Declaration
public static List<MailEnvelope> GetEnvelopeSet(SortedDictionary<string, MailEnvelope> sortedEnvelopes, int from, int to, bool reverse)
Parameters
| Type | Name | Description |
|---|---|---|
| SortedDictionary<string, MailEnvelope> | sortedEnvelopes | Source list to retrieve items from |
| int | from | Retrieve items from this index |
| int | to | Retrieve items to this index |
| bool | reverse | If true, retrieve items starting from the end of the list |
Returns
| Type | Description |
|---|---|
| List<MailEnvelope> | List of MailEnvelopes as specified by input parameters |
GetFileExtensionValidatorAsync(CancellationToken)
Get a validator for file extensions
Declaration
public static Task<FileExtensionValidator> GetFileExtensionValidatorAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FileExtensionValidator> |
GetMissingIds(List<MailEnvelope>, MailEnvelope[])
Find all items that exist in first set, and not in second set
Declaration
public static List<int> GetMissingIds(List<MailEnvelope> first, MailEnvelope[] second)
Parameters
| Type | Name | Description |
|---|---|---|
| List<MailEnvelope> | first | First set of MailEnvelope items |
| MailEnvelope[] | second | Second set of MailEnvelope items |
Returns
| Type | Description |
|---|---|
| List<int> | List of MailEnvelope.ServerId |
GetPlainHTMLBody(string)
Retrieve plain text version of a html source
Declaration
public static string GetPlainHTMLBody(string source)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | HTML to convert to plain text |
Returns
| Type | Description |
|---|---|
| string | Plain text version of the provided html |
GetSortString(MailSortCriterion, MailEnvelope)
Based on a sort order, find and format the proper value of MailEnvelope
Declaration
public static string GetSortString(MailSortCriterion sortOrder, MailEnvelope env)
Parameters
| Type | Name | Description |
|---|---|---|
| MailSortCriterion | sortOrder | What field to use for sorting |
| MailEnvelope | env | The envelope instance to get data from |
Returns
| Type | Description |
|---|---|
| string | Formatted string that may be used for sorting a set of MailEnvelopes |
PopulateEnvelopesArchivedInfoAsync(MailEnvelope[], CancellationToken)
Loop through envelopes and find connections to archived activities/documents
Declaration
public static Task PopulateEnvelopesArchivedInfoAsync(MailEnvelope[] envelopes, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| MailEnvelope[] | envelopes | Envelopes to populate |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
PopulateEnvelopesCompanyPersonInfoAsync(MailEnvelope[], CancellationToken)
Loop through envelopes and find companies and persons from SuperOffice that match the e-mails in sender properties (From address) of the envelope
Declaration
public static Task PopulateEnvelopesCompanyPersonInfoAsync(MailEnvelope[] envelopes, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| MailEnvelope[] | envelopes | Envelopes to populate |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ResolveAddressAsync(int[], CancellationToken)
Search database for one or more e-mail addresses by id, and return list with matched data
Declaration
public static Task<MailAddress[]> ResolveAddressAsync(int[] emailIds, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | emailIds | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<MailAddress[]> | List of MailAddress instances with matched data |
ResolveAddressAsync(string, CancellationToken, bool)
Search database for a single e-mail address, and return list with matched data
Declaration
public static Task<MailAddress[]> ResolveAddressAsync(string address, CancellationToken cancellationToken, bool onlyEmail = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address | Address to look for |
| CancellationToken | cancellationToken | |
| bool | onlyEmail | Bool we only want to search for EmailType.Email |
Returns
| Type | Description |
|---|---|
| Task<MailAddress[]> | List of MailAddress instances with matched data |
ResolveAddressesAsync(MailItem, CancellationToken)
Search database for all addresses in the provided set of MailAddress instances Limit each query to kMaxQueryInCount in parameters
Declaration
public static Task ResolveAddressesAsync(MailItem mailItem, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| MailItem | mailItem | MailItem whose addresses we want to resolve. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ResolveAddressesAsync(List<MailAddress>, CancellationToken)
Search database for all addresses in the provided set of MailAddress instances Limit each query to kMaxQueryInCount in parameters
Declaration
public static Task ResolveAddressesAsync(List<MailAddress> addressObjects, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| List<MailAddress> | addressObjects | List of MailAddress instances. MailAddress.Address property need to be populated in advance. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |