Class CreateEmailCampaignRequest
- Namespace
- Mailtrap.EmailCampaigns.Requests
- Assembly
- Mailtrap.Abstractions.dll
Request object for creating an email campaign.
The request body is sent flat (no envelope). The campaign is always created in the
Draft state - scheduling and starting are separate actions.
public sealed record CreateEmailCampaignRequest : IValidatable, IEquatable<CreateEmailCampaignRequest>
- Inheritance
-
CreateEmailCampaignRequest
- Implements
Properties
ContactListIds
Gets or sets the identifiers of the contact lists to send to.
Treated as the full set of included lists.
Combine with ContactSegmentIds to target both.
[JsonPropertyName("contact_list_ids")]
[JsonPropertyOrder(9)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IList<long>? ContactListIds { get; set; }
Property Value
ContactSegmentIds
Gets or sets the identifiers of the contact segments to send to.
Treated as the full set of included segments.
[JsonPropertyName("contact_segment_ids")]
[JsonPropertyOrder(10)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IList<long>? ContactSegmentIds { get; set; }
Property Value
DeliveryMode
Gets or sets how the campaign is delivered.
[JsonPropertyName("delivery_mode")]
[JsonPropertyOrder(7)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DeliveryMode? DeliveryMode { get; set; }
Property Value
- DeliveryMode
Delivery mode (Rapid or Gradual), or null to use the API default.
DeliveryOptions
Gets or sets the delivery throttling options. Applies when DeliveryMode is Gradual.
[JsonPropertyName("delivery_options")]
[JsonPropertyOrder(8)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public EmailCampaignDeliveryOptions? DeliveryOptions { get; set; }
Property Value
- EmailCampaignDeliveryOptions
Delivery throttling options, or null to omit.
DomainId
Gets or sets the identifier of the verified sending domain used for the campaign, as returned by the Sending Domains endpoints. Required.
[JsonPropertyName("domain_id")]
[JsonPropertyOrder(2)]
[JsonRequired]
public long? DomainId { get; set; }
Property Value
- long?
Sending domain identifier.
FromDisplayName
Gets or sets the display name shown in the From header.
[JsonPropertyName("from_display_name")]
[JsonPropertyOrder(3)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? FromDisplayName { get; set; }
Property Value
FromLocalPart
Gets or sets the local part (before the @) of the From address. Required.
[JsonPropertyName("from_local_part")]
[JsonPropertyOrder(4)]
[JsonRequired]
public string? FromLocalPart { get; set; }
Property Value
- string
From address local part.
Name
Gets or sets the campaign name. Required.
[JsonPropertyName("name")]
[JsonPropertyOrder(1)]
[JsonRequired]
public string? Name { get; set; }
Property Value
- string
Campaign name.
ReplyTo
Gets or sets the Reply-To address parts.
[JsonPropertyName("reply_to")]
[JsonPropertyOrder(5)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ReplyTo? ReplyTo { get; set; }
Property Value
TemplateAttributes
Gets or sets the template attributes - the campaign's subject and design. Required, with a non-empty Subject.
[JsonPropertyName("template_attributes")]
[JsonPropertyOrder(6)]
[JsonRequired]
public EmailCampaignTemplateAttributes? TemplateAttributes { get; set; }
Property Value
- EmailCampaignTemplateAttributes
Template attributes.
Methods
Validate()
Validates the current instance.
public ValidationResult Validate()
Returns
- ValidationResult
Object containing validation errors, if any.