Table of Contents

Class EmailCampaign

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

Represents an email campaign.

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

Properties

ContactListIds

Gets the identifiers of the contact lists included in the campaign's audience.

[JsonPropertyName("contact_list_ids")]
[JsonPropertyOrder(15)]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public IList<long> ContactListIds { get; }

Property Value

IList<long>

Contact list identifiers.

ContactSegmentIds

Gets the identifiers of the contact segments included in the campaign's audience.

[JsonPropertyName("contact_segment_ids")]
[JsonPropertyOrder(16)]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public IList<long> ContactSegmentIds { get; }

Property Value

IList<long>

Contact segment identifiers.

CreatedAt

Gets or sets the date and time the campaign was created.

[JsonPropertyName("created_at")]
[JsonPropertyOrder(10)]
public DateTimeOffset? CreatedAt { get; set; }

Property Value

DateTimeOffset?

Creation timestamp.

CurrentState

Gets or sets the current state of the campaign in its lifecycle.

[JsonPropertyName("current_state")]
[JsonPropertyOrder(8)]
public CampaignState CurrentState { get; set; }

Property Value

CampaignState

Current campaign state. Allowed values: "draft", "scheduled", "started", "queued", "paused", "terminating", "under_review", "finished", "failed", "failed_immediately".

CurrentStateMetadata

Gets or sets metadata about the most recent state transition.

[JsonPropertyName("current_state_metadata")]
[JsonPropertyOrder(9)]
public EmailCampaignStateMetadata? CurrentStateMetadata { get; set; }

Property Value

EmailCampaignStateMetadata

State transition metadata, or null when not present.

DeliveryMode

Gets or sets how the campaign is delivered.

[JsonPropertyName("delivery_mode")]
[JsonPropertyOrder(17)]
public DeliveryMode DeliveryMode { get; set; }

Property Value

DeliveryMode

Delivery mode. Allowed values: "rapid", "gradual".

DeliveryOptions

Gets or sets the delivery throttling options.

[JsonPropertyName("delivery_options")]
[JsonPropertyOrder(18)]
public EmailCampaignDeliveryOptions? DeliveryOptions { get; set; }

Property Value

EmailCampaignDeliveryOptions

Delivery throttling options, or null when not set.

DomainId

Gets or sets the identifier of the sending domain used for the campaign, as returned by the Sending Domains endpoints.

[JsonPropertyName("domain_id")]
[JsonPropertyOrder(2)]
public long DomainId { get; set; }

Property Value

long

Sending domain identifier.

DomainName

Gets or sets the name of the sending domain used for the campaign.

[JsonPropertyName("domain_name")]
[JsonPropertyOrder(3)]
public string? DomainName { get; set; }

Property Value

string

Sending domain name.

FromDisplayName

Gets or sets the display name shown in the From header.

[JsonPropertyName("from_display_name")]
[JsonPropertyOrder(6)]
public string? FromDisplayName { get; set; }

Property Value

string

From display name.

FromLocalPart

Gets or sets the local part (before the @) of the From address.

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

Property Value

string

From address local part.

Id

Gets or sets the email campaign identifier.

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

Property Value

long

Email campaign identifier.

LastStartedAt

Gets or sets the date and time the campaign was last started.

[JsonPropertyName("last_started_at")]
[JsonPropertyOrder(12)]
public DateTimeOffset? LastStartedAt { get; set; }

Property Value

DateTimeOffset?

Timestamp the campaign was last started, or null when it has never been started.

LastStartedAtDate

Gets or sets the date the campaign was last started.

[JsonPropertyName("last_started_at_date")]
[JsonPropertyOrder(13)]
public string? LastStartedAtDate { get; set; }

Property Value

string

Date the campaign was last started, present only when the campaign has been started.

Name

Gets or sets the campaign name.

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

Property Value

string

Campaign name.

RecipientTotalCount

Gets or sets the total number of recipients targeted by the campaign.

[JsonPropertyName("recipient_total_count")]
[JsonPropertyOrder(14)]
public int? RecipientTotalCount { get; set; }

Property Value

int?

Total number of recipients, or null until the audience is resolved.

ReplyTo

Gets or sets the Reply-To address parts.

[JsonPropertyName("reply_to")]
[JsonPropertyOrder(7)]
public ReplyTo? ReplyTo { get; set; }

Property Value

ReplyTo

Reply-To address parts, or null when not set.

Template

Gets or sets the template associated with the campaign.

[JsonPropertyName("template")]
[JsonPropertyOrder(19)]
public EmailCampaignTemplate? Template { get; set; }

Property Value

EmailCampaignTemplate

Campaign template, or null when not present.

UpdatedAt

Gets or sets the date and time the campaign was last updated.

[JsonPropertyName("updated_at")]
[JsonPropertyOrder(11)]
public DateTimeOffset? UpdatedAt { get; set; }

Property Value

DateTimeOffset?

Last update timestamp.