If you’re managing a Plesk server with multiple domains and want to enable DKIM signing for all of them quickly, this guide is for you.
Why DKIM Matters
DKIM (DomainKeys Identified Mail) helps prevent email spoofing by attaching a cryptographic signature to outgoing messages. Without DKIM, your emails are more likely to land in spam or be rejected entirely — especially by strict providers like Gmail, Outlook, or Yahoo.
The CLI Way: Enable DKIM for All Domains in Seconds
for domain in $(plesk bin domain --list); do
plesk bin site -u "$domain" -mail_service true;
plesk bin domain_pref --update "$domain" -sign_outgoing_mail true;
done
What this script does:
- Lists all domains on your Plesk server.
- Ensures that the mail service is enabled for each domain.
- Enables DKIM signing for outgoing emails on each domain.
If you don’t use Plesk for DNS (e.g., you’re on Cloudflare, Route53, or external nameservers), you’ll need to manually copy each domain’s DKIM public key to its DNS zone.
Enabling DNS for all domains:
for domain in $(plesk bin domain --list); do
echo "Enabling DNS for $domain"
plesk bin site -u "$domain" -dns true
done
Before running this command temporarily disable “Use the serial number format recommended by IETF and RIPE” in Tools & Settings > DNS Settings > Zone Settings Template


Leave a Reply