Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

How to replace an SPF record for all domains?

 
dnsdomainslinuxlinux servermail

How to update an SPF record for all domains that already have a particular record?

Answer

Plesk for Linux
Plesk for Windows

To replace an SPF record for all domains in Plesk on a Linux Server

  1. Connect to the server via SSH;

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

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

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

  1. Connect to the server via RDP

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

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

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

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

How to Check Open Ports in Linux (Simple Commands & Tools)

Read More »

Linux Logs Explained

Read More »

DNS_PROBE_FINISHED_NXDOMAIN: What Is It And How To Fix The Problem

Read More »
Knowledge Base

Cannot remove IP address from Plesk server: The IP address 203.0.113.2 is already used for hosting

Read More »

How to enable DKIM spam protection for outgoing emails of particular domain in Plesk

Read More »

How to enable / disable Plesk debug mode

Read More »

How to enable/disable HTTPS redirection for webmail in Plesk for Linux

Read More »

Hosting Wiki

  • RESTful Web Service
  • Server Redundancy
  • Cloud Service Architecture
  • Virtualizor
  • QMAIL
  • Sendmail
  • On-Demand Services
  • Linux Containers
  • Bare Metal Server
  • Denial of Service
  • Red Hat Virtualization
  • Virtuozzo
  • Oracle VM Server
  • Citrix Hypervisor
  • Server Virtualization Software
  • Windows Server
  • Linux
  • Virtualization
  • Domain
  • VirtualMin
  • Plesk
  • Web Server
  • Static DNS
  • DNS Server
  • DNS Forwarding
  • Reverse DNS
  • SSH
  • Email Autoresponder
  • Mailing Lists
  • Email Alias
  • Email Virus Protection
  • Email Forwarding
  • Webmail
  • SPF Record
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family