Disable Mail for all domains in Plesk

/ Published in: Bash
Save to your folder(s)

Copy this code and paste it in your HTML
  1. #!/bin/bash
  2. # This script finds all sites in Plesk that have the mail enabled, then disables them.
  4. SiteList=`egrep 'Server(Name)' /var/www/vhosts/*/conf/httpd.include|awk '{print $3}'|grep -v www.*|grep -v '^.*\..*\..*$'|sed 's/:80//'|sed 's/:443//'|sort -u`;
  6. for Site in $SiteList
  7. do
  8. Result=`/usr/local/psa/bin/domain -i $Site | grep 'Mail service' | awk '{print $3}'`;
  9. if [ $Result == On ]; then
  10. Command=`/usr/local/psa/bin/domain -u $Site -mail_service false`
  11. echo "Turning Off Mail Service: $Site";
  12. fi
  13. done

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.