DNS Server : Add SPF record2024/11/28 |
Set up a Sender Policy Framework (SPF) record to verify the validity of the domain from which the email is sent.
This example is based on the environment that the [srv.world] domain uses the network range [172.16.0.80/29]. For information on how to write an SPF record, please see [2] here. |
|
[1] | Add a TXT record to the zone file that contains the target domain name and set SPF there. |
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. # set the contents of the SPF record and register it # If you want to set it for a specific subdomain, enter the subdomain name in the [-Name] argument PS C:\Users\Administrator> $recordtext="v=spf1 +ip4:172.16.0.82 -all" PS C:\Users\Administrator> Add-DnsServerResourceRecord -Name "." -DescriptiveText $recordtext -TXT -ZoneName "srv.world" -PassThru HostName RecordType Type Timestamp TimeToLive RecordData -------- ---------- ---- --------- ---------- ---------- @ TXT 16 0 01:00:00 v=spf1 +ip4:172.16.0.82 -all PS C:\Users\Administrator> Get-DnsServerResourceRecord -ZoneName "srv.world" | Format-Table -AutoSize -Wrap # SPF record has been added HostName RecordType Type Timestamp TimeToLive RecordData -------- ---------- ---- --------- ---------- ---------- @ NS 2 0 01:00:00 rx-7.srv.world. @ SOA 6 0 01:00:00 [13][rx-7.srv.world.][hostmaster.srv.world.] @ TXT 16 0 01:00:00 v=spf1 +ip4:172.16.0.82 -all dns A 1 0 01:00:00 10.0.0.10 fd3s CNAME 5 0 01:00:00 rx-7.srv.world. rx-7 A 1 0 01:00:00 10.0.0.101 rx-8 A 1 0 01:00:00 10.0.0.102 rx-8 MX 15 0 01:00:00 [10][rx-8.srv.world.] # verify PS C:\Users\Administrator> Resolve-DnsName srv.world -Server 127.0.0.1 -Type txt Name Type TTL Section Strings ---- ---- --- ------- ------- srv.world TXT 3600 Answer {v=spf1 +ip4:172.16.0.82 -all} # if remove it, run like follows PS C:\Users\Administrator> Remove-DnsServerResourceRecord -ZoneName "srv.world" -RRType "TXT" -Name "." -RecordData "v=spf1 +ip4:172.16.0.82 -all" -PassThru Confirm Removing DNS resource record . of type TXT from zone srv.world on RX-7 server. Do you want to continue? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y HostName RecordType Type Timestamp TimeToLive RecordData -------- ---------- ---- --------- ---------- ---------- @ TXT 16 0 01:00:00 v=spf1 +ip4:172.16.0.82 -all |
DNS Server : Add SPF record (GUI)
|
On GUI configuration, set like follows. |
|
[2] | Run Server Manager and select [Tools] - [DNS], next right-click the domain name to show menu on the left pane, then select [Other New Records]. |
[3] | Select [Text (TXT)] . |
[4] | Enter the text you want to set in the [Text] field at the bottom. You can leave the [Record Name] field at the top blank if you are setting it for the parent domain. Or enter the record name if you set it for a subdomain. |
[5] | You will be returned to the original screen, so click the [Done] button to complete the setup. |
[6] | The TXT record for SPF has been added. |
Sponsored Link |
|