Table of Contents

Class EmailCampaignTemplateAttributes

Namespace
Mailtrap.EmailCampaigns.Requests
Assembly
Mailtrap.Abstractions.dll

Represents the template attributes of an email campaign create/update request - the campaign's subject and design.
The campaign's template is always edited in place and updates are partial: only the sub-fields you provide change; omitted sub-fields keep their current value.

public sealed record EmailCampaignTemplateAttributes : IEquatable<EmailCampaignTemplateAttributes>
Inheritance
EmailCampaignTemplateAttributes
Implements

Properties

BodyHtml

Gets or sets the HTML body of the email (the design).
Optional for a draft; required before the campaign can be scheduled or started. Include an unsubscribe link via an anchor whose href contains the unsubscribe_url placeholder. Supports {{tag_name}} merge tags.

[JsonPropertyName("body_html")]
[JsonPropertyOrder(2)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BodyHtml { get; set; }

Property Value

string

HTML body, or null to leave unchanged.

BodyText

Gets or sets the plain-text alternative of the email body.
Supports the same unsubscribe_url placeholder and {{tag_name}} merge tags as BodyHtml.

[JsonPropertyName("body_text")]
[JsonPropertyOrder(3)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BodyText { get; set; }

Property Value

string

Plain-text body, or null to leave unchanged.

MergeTags

Gets or sets the bare names of the merge tags referenced in the subject/body, without the {{ }} delimiters - e.g. ["first_name"] when the content contains {{first_name}}.
Replaced as a whole when provided.

[JsonPropertyName("merge_tags")]
[JsonPropertyOrder(4)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IList<string>? MergeTags { get; set; }

Property Value

IList<string>

Merge tag names, or null to leave unchanged.

Subject

Gets or sets the email subject line.
Required when creating a campaign. Supports merge tags, e.g. Hi {{first_name}}.

[JsonPropertyName("subject")]
[JsonPropertyOrder(1)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Subject { get; set; }

Property Value

string

Email subject line, or null to leave unchanged.