Removing and adding SPF files to cPanel accounts.
I'm changing my email provider on my server, but for all emails to work correctly, I need the SPF file configured. I need a command to remove all current SPF files from the server and a new command to add the new SPF file to all cPanel accounts. I need this because there are 500 cPanel accounts. Could someone help me?
-
Hey there! We do have a tool for this you can find at https://api.docs.cpanel.net/specifications/cpanel.openapi/email-dns-settings/emailauth-install_spf_records
This will install an SPF record on one or more domains, replacing what is already there. You can just pass multiple domains to the installer with your desired record, such as this example showing two domains:
whmapi1 install_spf_records \
domain-1=example.com record-1='v=spf1 a mx include:spf.example.net -all' \
domain-2=example.net record-2='v=spf1 a mx include:spf.example.net -all'This API call also updates the zone's serial number, so you don't need to do any additional work there.
As always, I would make a backup of your records first, and test this on an individual or small batch of domains before applying it to all 500 accounts.
0
Please sign in to leave a comment.
Comments
1 comment