--- // Reusable zone-file export block. Mirrors web/templates/marque_import.go // ZoneFileExportFromFields + renderZoneFileExportSection: takes the // same six fields and emits a textarea with the SPF/DMARC/DKIM records // in zone-file format, plus a "Copy to clipboard" button. // // Usage: // // // Returns nothing renderable when domain or relayPublicIP is empty — // matches the Go formatter's "no relay IP means no SPF, so no export" // branch. export interface Props { domain: string; relayPublicIP: string; rsaDNSName?: string; rsaRecord?: string; edDNSName?: string; edRecord?: string; /** DMARC reporting mailbox; keep in sync with marque_import.go * dmarcReportingMailbox. */ dmarcReportingMailbox?: string; } const { domain, relayPublicIP, rsaDNSName, rsaRecord, edDNSName, edRecord, dmarcReportingMailbox = "postmaster@atmos.email", } = Astro.props; /** Strip a trailing `.` from an FQDN to produce the relative * form a zone-file importer expects. Mirrors marque.RelativeName. */ function relativeName(name: string, dom: string): string { if (!name) return "@"; if (name === dom) return "@"; const suffix = "." + dom; if (name.endsWith(suffix)) { return name.slice(0, -suffix.length); } return name; } interface ZoneRecord { name: string; type: string; ttl: number; value: string; } function buildRecords(): ZoneRecord[] { const records: ZoneRecord[] = [ { name: "@", type: "TXT", ttl: 3600, value: `v=spf1 ip4:${relayPublicIP} -all`, }, { name: "_dmarc", type: "TXT", ttl: 3600, value: `v=DMARC1; p=reject; adkim=r; aspf=r; rua=mailto:${dmarcReportingMailbox}`, }, ]; if (rsaDNSName && rsaRecord) { records.push({ name: relativeName(rsaDNSName, domain), type: "TXT", ttl: 3600, value: rsaRecord, }); } if (edDNSName && edRecord) { records.push({ name: relativeName(edDNSName, domain), type: "TXT", ttl: 3600, value: edRecord, }); } return records; } function formatZoneFile(records: ZoneRecord[]): string { // Same column layout marque.FormatImport produces: name, type, ttl, // value separated by single spaces. Quoting was removed in PR #632 // (internal ref) so we emit values raw. return records.map((r) => `${r.name} ${r.type} ${r.ttl} ${r.value}`).join("\n"); } const enabled = Boolean(domain && relayPublicIP); const exportText = enabled ? formatZoneFile(buildRecords()) : ""; const rowCount = enabled ? Math.max(4, exportText.split("\n").length) : 4; --- { enabled && (

Export DNS records (zone-file format)

Paste the block below into any registrar that accepts zone-file syntax: Cloudflare's Import and Export, BIND, Marque's bulk-import dialog, etc. Same records as above for {domain}, one paste instead of four.

Bulk import doesn't expose your DNS host credentials to comail. We just format the records; you paste them on the host you already control.

) }