Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to add SPF record for all domains on Plesk server?
Answer
SPF record for all domains can be added as follows:
-
Connect to the server via RDP and open command prompt as Administrator
-
Get the list of domains:
C:\> "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT name FROM domains" > dns.txt
-
Add TXT record for all domains as follows:
C:\> for /f "skip=1" %i in (dns.txt); do ("%plesk_cli%\dns.exe" -a %i -txt "v=spf1 some_spf_text")
Note: Change
some_spf_text
by the required record. For more information see: How to create SPF rule for the domain?
-
Connect to the server via SSH
-
Find domains without spf TXT record:
# plesk db -Ne "select name from domains where dns_zone_id not in (select dns_zone_id from dns_recs where type='TXT' and val like '%spf%');" > domains_without_spf.txt
-
Add spf record
# cat domains_without_spf.txt | while read i; do echo $i; plesk bin dns -a $i -txt "some_spf_text" ;done
Note: Change
some_spf_text
by the required record. For more information see: How to create SPF rule for the domain?
Comments
0 comments
Please sign in to leave a comment.