Applicable to:
- Plesk for Linux
- Plesk for Windows
How to update an SPF record for all domains that already have a particular record?
Answer
To replace an SPF record for all domains in Plesk on a Linux Server
-
Connect to the server via SSH;
-
Create a list of domains:
# plesk bin domain --list > domains.txt
Note: If the modifications are required for specific domains only, modify the
domains.txt
list as needed. Vi Editor can be used. -
Remove all specific SPF records (e.g. "
specific record
") from ALL domains:# for i in $(cat domains.txt); do plesk bin dns -d $i -txt "specific record"; done
-
Add the new SPF record (e.g. "
new spf record
") as follows:# for i in $(cat domains.txt); do plesk bin dns -a $i -txt "new spf record"; done
To replace an SPF record for all domains in Plesk on a Windows Server
-
Connect to the server via RDP
-
From a Command Prompt (cmd) create a list of all domains that contain a specific SPF record, e.g.
specific_record
:plesk db -Ne "SELECT d.name FROM domains AS d, dns_zone AS z, dns_recs AS r WHERE d.name=z.name AND z.id=r.dns_zone_id AND r.type='txt' AND val LIKE '%specific_record%';" > domains.txt
Note: If the modifications are needed for specific domains only, modify the
domains.txt
list as needed with your preferred text editor. -
Delete all SPF records containing the
specific_record
value from the list of domains:for /f %i in (domains.txt) do "%plesk_cli%\dns.exe" -d %i -txt "specific_record"
If the following output is received for some line, safely ignore it:
Unable to del record in DNS server: unable to find DNS record
-
Create new SPF records for domains in the same list, e.g.
new_spf_record
:for /f %i in (domains.txt) do "%plesk_cli%\dns.exe" -a %i -txt "new_spf_record"
Despite the number of Domains on the list, even a single SPF record change can take up to 48 hours to fully propagate on its DNS Zone.
Comments
0 comments
Please sign in to leave a comment.