1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
//! Domains API endpoints for managing domain details in a Postmark account.
pub use create_domain::*;
pub use delete_domain::*;
pub use edit_domain::*;
pub use get_domain::*;
pub use list_domains::*;
pub use rotate_dkim::*;
pub use verify_dkim::*;
pub use verify_return_path::*;
pub use verify_spf::*;
use crate::api::types::id_type;
use serde::{Deserialize, Serialize};
id_type!(pub DomainId);
mod create_domain;
mod delete_domain;
mod edit_domain;
mod get_domain;
mod list_domains;
mod rotate_dkim;
mod verify_dkim;
mod verify_return_path;
mod verify_spf;
/// Status of a DKIM update operation.
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
pub enum DkimUpdateStatus {
/// DKIM renewal or setup is in progress.
#[default]
Pending,
/// All DNS TXT records are up to date and any pending operations are finished.
Verified,
/// DKIM verification failed.
Failed,
/// Catch-all for any status not yet represented in this enum.
#[serde(untagged)]
Unknown(String),
}
/// Summary of a domain as returned by the list domains endpoint.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DomainSummary {
/// Domain name.
pub name: String,
/// Deprecated. See Postmark's blog post on why SPF records are no longer required.
#[serde(rename = "SPFVerified")]
pub spf_verified: bool,
/// Whether DKIM has ever been verified for the domain.
/// Once verified, this stays true even if the record is later removed from DNS.
#[serde(rename = "DKIMVerified")]
pub dkim_verified: bool,
/// Whether DKIM is using a strength weaker than 1024 bit.
#[serde(rename = "WeakDKIM")]
pub weak_dkim: bool,
/// Whether the Return-Path domain is actively being used.
pub return_path_domain_verified: bool,
/// Unique ID of the domain.
#[serde(rename = "ID")]
pub id: DomainId,
}
/// Full domain details as returned by get, create, edit, and verify endpoints.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct DomainDetails {
/// Domain name.
pub name: String,
/// Deprecated. See Postmark's blog post on why SPF records are no longer required.
#[serde(rename = "SPFVerified")]
pub spf_verified: bool,
/// Host name used for the SPF configuration.
#[serde(rename = "SPFHost")]
pub spf_host: String,
/// Value that can be optionally set up with your DNS host for SPF verification.
#[serde(rename = "SPFTextValue")]
pub spf_text_value: String,
/// Whether DKIM has ever been verified for the domain.
/// Once verified, this stays true even if the record is later removed from DNS.
#[serde(rename = "DKIMVerified")]
pub dkim_verified: bool,
/// Whether DKIM is using a strength weaker than 1024 bit.
/// If so, you can request a new DKIM via [`RotateDkimRequest`].
#[serde(rename = "WeakDKIM")]
pub weak_dkim: bool,
/// DNS TXT host being used to validate messages sent in.
#[serde(rename = "DKIMHost")]
pub dkim_host: String,
/// DNS TXT value being used to validate messages sent in.
#[serde(rename = "DKIMTextValue")]
pub dkim_text_value: String,
/// Pending DKIM DNS TXT host awaiting setup and confirmation at your registrar or DNS host.
#[serde(rename = "DKIMPendingHost")]
pub dkim_pending_host: String,
/// Pending DKIM DNS TXT value awaiting confirmation at your registrar or DNS host.
#[serde(rename = "DKIMPendingTextValue")]
pub dkim_pending_text_value: String,
/// The old DKIM host that Postmark has revoked after a new DKIM was confirmed.
#[serde(rename = "DKIMRevokedHost")]
pub dkim_revoked_host: String,
/// The old DKIM DNS TXT value that will soon be removed from the Postmark system.
#[serde(rename = "DKIMRevokedTextValue")]
pub dkim_revoked_text_value: String,
/// Whether you may safely delete the old revoked DKIM DNS TXT records.
#[serde(rename = "SafeToRemoveRevokedKeyFromDNS")]
pub safe_to_remove_revoked_key_from_dns: bool,
/// DKIM update status.
#[serde(rename = "DKIMUpdateStatus")]
pub dkim_update_status: DkimUpdateStatus,
/// Custom Return-Path domain. Must be a subdomain of your From Email domain
/// with a CNAME record pointing to `pm.mtasv.net`.
pub return_path_domain: String,
/// Whether the Return-Path domain is actively being used.
pub return_path_domain_verified: bool,
/// The CNAME DNS record that Postmark expects to find at the Return-Path domain.
#[serde(rename = "ReturnPathDomainCNAMEValue")]
pub return_path_domain_cname_value: String,
/// Unique ID of the domain.
#[serde(rename = "ID")]
pub id: DomainId,
}