How to turn off mail for every domain in plesk

Here is a little script that will turn off mail for every domain in plesk! I use it as part of an automated domain creation script to be doubly sure that mail is sent from external mail services and isn’t received internally in the plesk machine (preventing users getting their mails)

Script to turn off mail for every domain in plesk

#!/bin/sh 
# change this bit if you want to disable on a specific domain -- just add the domain name you want
dir=`ls /var/www/vhosts/`
for dirs in $dir; do
/usr/local/psa/bin/mail --off $dirs
done

There used to be a setting in the plesk control panel to turn this off per domain, but its been disabled now.

Leave a Reply