Creating message bodies

To create a message body, you must use the NewslattersManager class. The following code creates a message body with the specifiedIDNameBodyText, and MessageBodyType through the Native API.

public void CreateMessageBody(Guid id, string name, MessageBodyType bodyType, string bodyText, bool isTemplate)
{
    NewslettersManager manager = NewslettersManager.GetManager();
    MessageBody messageBody = manager.GetMessageBodies().Where(b => b.Id == id).SingleOrDefault();
 
    if (messageBody == null)
    {
        messageBody = manager.CreateMessageBody(id);
        messageBody.Name = name;
        messageBody.MessageBodyType = bodyType;
        messageBody.BodyText = bodyText;
        messageBody.IsTemplate = isTemplate;
        manager.SaveChanges();
    }
}

First, you initialize the NewslettersManager. Then, you call CreateMessageBody to create a message body. Finally, after all properties are set, you save the changes.

NOTE: To create a campaign with auto generated ID, use the other overload of the CreateMessageBody method.

NOTE: To indicate that the message body must be used as a template, you must set the IsTemplate property to true.

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK