Articles in this section

How to add SPF record for all domains on Plesk server?

Plesk for Windows kb: how-to Plesk for Linux ABT: Group B

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:

For Windows
  1. Connect to the server via RDP and open command prompt as Administrator

  2. Get the list of domains:

    C:\> "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT name FROM domains" > dns.txt

  3. 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?

For Linux
  1. Connect to the server via SSH

  2. 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

  3. 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?

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.