Creating message bodies
To create a message body, you must use the NewslattersManager class. The following code creates a message body with the specifiedID, Name, BodyText, 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.