@@ -119,6 +119,23 @@ export type GetDomainDNSRecordsOutput =
119
119
optimal : string ;
120
120
acceptable : string ;
121
121
} ;
122
+ mtaSts : {
123
+ dns : {
124
+ valid : boolean ;
125
+ name : string ;
126
+ value : string ;
127
+ } ;
128
+ tls : {
129
+ valid : boolean ;
130
+ name : string ;
131
+ value : string ;
132
+ } ;
133
+ policy : {
134
+ valid : boolean ;
135
+ name : string ;
136
+ value : string ;
137
+ } ;
138
+ } ;
122
139
}
123
140
| { error : string } ;
124
141
@@ -168,6 +185,23 @@ export async function getDomainDNSRecords(
168
185
name : '' ,
169
186
optimal : '' ,
170
187
acceptable : ''
188
+ } ,
189
+ mtaSts : {
190
+ dns : {
191
+ valid : false ,
192
+ name : '' ,
193
+ value : ''
194
+ } ,
195
+ tls : {
196
+ valid : false ,
197
+ name : '' ,
198
+ value : ''
199
+ } ,
200
+ policy : {
201
+ valid : false ,
202
+ name : '' ,
203
+ value : ''
204
+ }
171
205
}
172
206
} ;
173
207
@@ -313,7 +347,7 @@ export async function getDomainDNSRecords(
313
347
}
314
348
records . mx . name = domainInfo . name ;
315
349
records . mx . priority = 1 ;
316
- records . mx . value = `mx. ${ postalServerUrl } ` ;
350
+ records . mx . value = `${ postalServerUrl } ` ;
317
351
records . mx . valid = true ;
318
352
319
353
if ( domainInfo . mxStatus !== 'OK' || forceReverify ) {
@@ -356,6 +390,40 @@ export async function getDomainDNSRecords(
356
390
records . dmarc . name = '_dmarc' ;
357
391
records . dmarc . optimal = buildDmarcRecord ( { p : 'reject' } ) ;
358
392
records . dmarc . acceptable = buildDmarcRecord ( { p : 'quarantine' } ) ;
393
+
394
+ const mtaStsDnsRecord = await lookupTXT ( `_mta-sts.${ domainInfo . name } ` ) ;
395
+ records . mtaSts . dns . name = '_mta-sts' ;
396
+ records . mtaSts . dns . value = `v=STSv1; id=${ Date . now ( ) } ` ;
397
+ if ( mtaStsDnsRecord . success && mtaStsDnsRecord . data . length > 0 ) {
398
+ records . mtaSts . dns . valid =
399
+ mtaStsDnsRecord . data . filter (
400
+ ( _ ) => _ . startsWith ( 'v=STSv1;' ) && _ . includes ( 'id=' )
401
+ ) . length === 1 ;
402
+ }
403
+
404
+ const mtaStsTlsRecord = await lookupTXT ( `_smtp._tls.${ domainInfo . name } ` ) ;
405
+ records . mtaSts . tls . name = '_smtp._tls' ;
406
+ records . mtaSts . tls . value = `v=TLSRPTv1; rua=mailto:[email protected] ` ;
407
+ if ( mtaStsTlsRecord . success && mtaStsTlsRecord . data . length > 0 ) {
408
+ records . mtaSts . tls . valid =
409
+ mtaStsTlsRecord . data . filter (
410
+ ( _ ) =>
411
+ _ . startsWith ( 'v=TLSRPTv1;' ) &&
412
+ _ . includes ( 'rua=' ) &&
413
+ _ . includes ( 'mailto:[email protected] ' )
414
+ ) . length === 1 ;
415
+ }
416
+
417
+ const mtaStsPolicyRecord = await lookupCNAME ( `mta-sts.${ domainInfo . name } ` ) ;
418
+ records . mtaSts . policy . name = 'mta-sts' ;
419
+ records . mtaSts . policy . value = `mta-sts.${ postalServerUrl } ` ;
420
+ if (
421
+ mtaStsPolicyRecord . success &&
422
+ mtaStsPolicyRecord . data . includes ( records . mtaSts . policy . value )
423
+ ) {
424
+ records . mtaSts . policy . valid = true ;
425
+ }
426
+
359
427
return records ;
360
428
}
361
429
0 commit comments