Class EmailTemplateRequest
- Namespace
- Mailtrap.EmailTemplates.Requests
- Assembly
- Mailtrap.Abstractions.dll
Generic request object for email template CRUD operations.
public record EmailTemplateRequest : IValidatable, IEquatable<EmailTemplateRequest>
- Inheritance
-
EmailTemplateRequest
- Implements
- Derived
Constructors
EmailTemplateRequest(string, string, string)
Primary instance constructor.
[JsonConstructor]
public EmailTemplateRequest(string name, string category, string subject)
Parameters
namestringName of the email template.
categorystringCategory of the email template.
subjectstringSubject of the email template.
Remarks
The name must be between 1 and 255 characters.
The category must be between 1 and 255 characters.
The subject must be between 1 and 255 characters.
Exceptions
- ArgumentNullException
When
nameis null or Empty. Whencategoryis null or Empty. Whensubjectis null or Empty.
Properties
BodyHtml
Gets or sets the email template body html.
[JsonPropertyName("body_html")]
[JsonPropertyOrder(7)]
public string BodyHtml { get; set; }
Property Value
- string
Email template body html.
Remarks
Email template body html must be no longer than 10_000_000 characters.
BodyText
Gets or sets the email template body text.
[JsonPropertyName("body_text")]
public string BodyText { get; set; }
Property Value
- string
Email template body text.
Remarks
Email template body text must be no longer than 10_000_000 characters.
Category
Gets or sets the email template category.
[JsonPropertyName("category")]
[JsonRequired]
public string Category { get; set; }
Property Value
- string
Email template category.
Remarks
Email template category must be no longer than 255 characters.
Name
Gets or sets email template name.
[JsonPropertyName("name")]
[JsonRequired]
public string Name { get; set; }
Property Value
- string
Email template name.
Remarks
Email template name must be no longer than 255 characters.
Subject
Gets or sets the email template subject.
[JsonPropertyName("subject")]
[JsonRequired]
public string Subject { get; set; }
Property Value
- string
Email template subject.
Remarks
Email template subject must be no longer than 255 characters.
Methods
Validate()
Validates the current instance.
public ValidationResult Validate()
Returns
- ValidationResult
Object containing validation errors, if any.