Since there will always be a system email account
with any new DA User, sometimes Admin's do not wish it to be active, as many clients simply don't know it's there or don't use it. It can then fill up with a lot of email, causing disk usage issues.
One solution is to disable the account for any domain created under that User. Note that the actual firstname.lastname@example.org value will still be active (can be disabled in /etc/aliases if you really want), but for the most part, disabling the alias email@example.com -> firstname.lastname@example.org will be sufficient for most cases.
The email@example.com is actually a forwarder to the hostname, so in this guide we're just going to disable that forwarder.
Create the following script:
and in it, add the following code:
STR="perl -pi -e 's#^$username:[ ]*$username$#$username: :fail:#' /etc/virtual/$domain/aliases"
Chmod the script to 755:
chmod 755 /usr/local/directadmin/scripts/custom/domain_create_post.sh
You can manually test the script, and/or run it for existing accounts as follows:
username=fred domain=fredsdomain.com ./domain_create_post.sh
which does require a shell, like bash that supports setting variables in that manner.
Expanding on tip #3, you can run this for all existing accounts automatically with this script:
for u in `ls /usr/local/directadmin/data/users`; do
for d in `cat /usr/local/directadmin/data/users/$u/domains.list`; do
username=$u domain=$d /usr/local/directadmin/scripts/custom/domain_create_post.sh