Class Message
- Namespace
- Dynamicweb.Mailing
- Assembly
- Dynamicweb.Core.dll
A message object used for EmailMessaging.
- Inheritance
-
Message
- Inherited Members
Examples
using System;
namespace Dynamicweb.Mailing.Examples
{
class MessageRecipientSendingSample
{
public void SendMessage()
{
//Create a recipient collection and fill it with 100 recipients.
var recipientCollection = new RecipientCollection();
for (var i = 0; i < 100; i++)
{
var recipient = new Recipient();
recipient.Name = "Test" + i;
recipient.EmailAddress = string.Format("test{0}@testdomain.tld", i);
recipientCollection.Add(recipient);
}
//Create a message that will be sent.
var message = new Message();
message.Subject = "This is a test email";
message.HtmlBody = string.Format("<h1>Hello <!--@{0}--></h1><br /><p>This is a test</p>", Constants.TagRecipientName);
message.SenderEmail = "webshop@mydomain.tld";
message.SenderName = "Test Webshop";
//Instanciate the MessagingHandler, which will start the process.
//Using the CallbackHandler is reviewed in another example.
var handler = new MessagingHandler(message, recipientCollection);
var processStarted = handler.Process();
//The boolean 'processStarted' indicated whether the process of preprocessing, merging and sending was started.
//This process is run asynchronously in multiple threads to increase performance.
if (!processStarted)
throw new Exception("Sending could not be started");
}
}
}
Constructors
Message()
Creates a new Message instance.
Properties
DeliveryProvider
Gets the delivery provider.
Property Value
- Message
Delivery Provider Configuration The delivery provider.
DeliveryProviderId
Gets or sets the delivery provider id.
Property Value
- int
The delivery provider id.
DomainUrl
Gets or sets the domain URL.
Property Value
- string
The domain URL.
Encoding
Gets or sets the encoding.
Property Value
- Encoding
The encoding.
FileAttachmentPaths
Gets the file attachment paths.
Property Value
HtmlBody
Gets or sets the HTML body.
Property Value
- string
The HTML body.
Id
Gets the id.
Property Value
IncludePlainTextBody
Gets or sets a value indicating whether to include the plain text body in a multi-part message.
Property Value
- bool
true
if plain body should be included; otherwise,false
.
IsIncomplete
Property Value
- bool
True if message with specific id has incomplete recipients
IsNew
Gets a value indicating whether this instance is new.
Property Value
- bool
true
if this instance is new; otherwise,false
.
IsPreprocessed
Gets or sets a value indicating whether this instance is preprocessed.
Property Value
- bool
true
if this instance is preprocessed; otherwise,false
.
IsSending
Determines whether this Message is currently being sent.
Property Value
- bool
True if message sending operation is in progress
LinkParameters
Gets a dictionary containing all additional parameters that will be added to the links. These parameters are not applied in Preview mode.
Property Value
Links
Gets the links.
Property Value
PlainTextBody
Gets or sets the plain text body.
Property Value
- string
The plain body.
PreprocessedHtmlBody
Gets the preprocessed HTML body.
This content is produced by the Message
Property Value
QuarantinePeriod
Gets or sets the quarantine period (in minutes). The period in which the same Recipient is quarantined from receiving this Message.
This requires Requirefalse
to have effect.
Default is 0.
Property Value
- int
The quarantine period. This cannot be negative. Default is 0, indicating no quarantine period.
RecipientContentProvider
Gets or sets the recipient content provider.
This is used to provide recipient specific content. This is used if Recipienttrue
.
Property Value
- Recipient
Content Provider The content provider.
RecipientSpecificContent
Gets or sets a value indicating whether the messaging system should request body content per recipient or rely on the content in Htmlfalse
.
Setting this to true
requires Recipient
Property Value
- bool
true
if body content should be requested per recipient; otherwise,false
.
RecipientsSource
Gets or sets the recipients source.
This value indicated the source of the Recipient
Property Value
- string
The recipients source.
RequireUniqueRecipients
Gets or sets a value indicating whether require unique recipients.
The Recipient
Property Value
- bool
true
if recipients are required to be unique; otherwise,false
. Default istrue
.
SenderEmail
Gets or sets the sender email.
Property Value
- string
The sender email.
SenderName
Gets or sets the name of the sender.
Property Value
- string
The name of the sender.
SentTime
Gets the sent time.
Property Value
- Message
Sent Time Info The sent time.
Subject
Gets or sets the subject.
Property Value
- string
The subject.
Tags
Gets a dictionary containing all message body tags. These tags will be rendered into the message by the message merger. The tag values can contain the tags available in the Constants class. All tag constants start with "TAG_".
Property Value
Methods
GetMessageById(int)
Gets the message by id.
Parameters
id
intThe id.
Returns
IsMessageOpenedByRecipient(int, int)
Gets a value indicating whether the Message with the given id has been opened by the Recipient with the given id.
Parameters
Returns
MarkMessageAsOpenedByRecipient(string, int, int)
Parameters
Save()
Saves this instance.