Table of Contents

Class EmailCampaignTemplate

Namespace
Mailtrap.EmailCampaigns.Models
Assembly
Mailtrap.Abstractions.dll

Represents the template associated with an email campaign.
BodyHtml and BodyText are returned only on single-campaign responses - the list endpoint omits them to keep the payload small.

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

Properties

BodyHtml

Gets or sets the HTML body of the email (the design).

[JsonPropertyName("body_html")]
[JsonPropertyOrder(4)]
public string? BodyHtml { get; set; }

Property Value

string

HTML body, or null when not set or omitted (e.g. in list items).

BodyText

Gets or sets the plain-text alternative of the email body.

[JsonPropertyName("body_text")]
[JsonPropertyOrder(5)]
public string? BodyText { get; set; }

Property Value

string

Plain-text body, or null when not set or omitted (e.g. in list items).

Id

Gets or sets the template identifier.

[JsonPropertyName("id")]
[JsonPropertyOrder(1)]
public long Id { get; set; }

Property Value

long

Template identifier.

MergeTags

Gets the bare names of the merge tags referenced in the subject/body.

[JsonPropertyName("merge_tags")]
[JsonPropertyOrder(3)]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public IList<string> MergeTags { get; }

Property Value

IList<string>

Merge tag names, without the {{ }} delimiters.

Subject

Gets or sets the email subject line.

[JsonPropertyName("subject")]
[JsonPropertyOrder(2)]
public string? Subject { get; set; }

Property Value

string

Email subject line.