Skip to content
This repository has been archived by the owner on Feb 12, 2021. It is now read-only.

OutlookCOMM.NET

Matteo Parlato edited this page Nov 12, 2019 · 6 revisions

Helpers IMailUtilities
MailUtilitiesBase MailUtilities

Helpers

Helpers class

SplitAddressesByDelimiter(addresses, delimiter)

Method which separates a string containing multiple addresses using the given delimiter.

Name Description
addresses System.String
The string containing the addresses
delimiter System.Char
The delimiter used to separate the addresses

Returns

A collection of addresses

IMailUtilities

IMailUtilities interface

Attachments

The attachment collection used to store data attached to the mail.

BCC

The string which contains the blind carbon copy (BCC) recipients of the mail.

Body

The string which contains the body text of the mail.

CC

The string which contains the carbon copy (CC) recipients of the mail.

Delimiter

The string which contains the delimiter to use when splitting the addresses.

From

The string which contains the from address of the mail.

SaveEML

Method which creates and opens an EML file.

Returns

The result of the operation

Subject

The string which contains the subject line of the mail.

To

The string which contains the recipients of the mail.

Unsent

The boolean which determine whether is necessary to add the X-Unsent header to the mail.

UseOutlookAccount

The boolean which determine whether is necessary to use the From address configured in Outlook.

MailUtilitiesBase

MailUtilitiesBase abstract class

Constructor

Constructor with no parameters required for COM initialization.

Constructor(from, to, cc, bcc, subject, body)

Constructor which initializes a MailUtilitiesBase object with passed information.

Name Description
from System.String
The from address of the mail
to System.String
The recipients address (or addresses) of the mail
cc System.String
The CC recipients of the mail
bcc System.String
The BCC recipients of the mail
subject System.String
The subject line of the mail
body System.String
The body text of the mail

AddAttachment(filePath, fileName)

Method which allows to add a file to the Attachments collection.

Name Description
filePath System.String
The path of the file to add
fileName System.String
The text to use as file name

Attachments

The attachment collection used to store data attached to the mail.

Value

The key contains the path of the file added as an attachment while the value contains the text to use as file name for the attachment (can be empty).

BCC

The string which contains the blind carbon copy (BCC) recipients of the mail.

Body

The string which contains the body text of the mail.

CC

The string which contains the carbon copy (CC) recipients of the mail.

Delimiter

The string which contains the delimiter to use when splitting the addresses.

Value

The default value is ';'.

FinalizeEML

Method which finalizes the created EML file.

Remarks

Creates a copy of the created EML file with a known file name (SMTPClient.Send uses random GUIDs as file names when saving the EML to the disk). If UseOutlookAccount is true then X-Sender and From headers will be removed so that the mail account defined in Outlook is used as From address.

Returns

The path of finalized EML file

From

The string which contains the from address of the mail.

PrepareAttachments(message)

Method which initializes passed MailMessage Attachments property with the attachments added to the Attachments collection.

Name Description
message System.Net.Mail.MailMessage@
The MailMessage to initialize

PrepareMessage(message)

Method which initializes passed MailMessage object with the information specified in MailUtilitiesBase properties.

Name Description
message System.Net.Mail.MailMessage@
The MailMessage to initialize

PrepareTempFolder

Method which prepares the temp folder where the EML file will be stored.

Remarks

Recursively deletes previously created temporary files and folders to avoid possible conflicts when creating the new EML file.

SaveEML

Method which creates and opens an EML file.

Returns

The result of the operation

Subject

The string which contains the subject line of the mail.

To

The string which contains the recipients of the mail.

Unsent

The boolean which determine whether is necessary to add the X-Unsent header to the mail.

Value

The default value is true.

UseOutlookAccount

The boolean which determine whether is necessary to use the From address configured in Outlook.

Value

The default value is true.

MailUtilities

MailUtilities class

Constructor(System.String,System.String,System.String,System.String,System.String,System.String)

Constructor which initializes a MailUtilities object with passed information. OutlookCOMM.Core.MailUtilitiesBase.#ctor(System.String,System.String,System.String,System.String,System.String,System.String)

SaveEML

Method which creates an EML file. OutlookCOMM.Core.MailUtilitiesBase.SaveEML