Add to Favourites Add to Favourites    Print this Article Print this Article

Adding specific forwarders by default

If you wish for specific default forwarders be present for new domains, for example "postmaster", you can create the script:


and add the code


#modify the TO value as desired


   COUNT=`grep -c -e "^${1}:" ${ALIASES}`
   if [ "${COUNT}" -eq 0 ]; then
       echo "${1}: ${TO}" >> ${TEMP_ALIASES}
       cat ${ALIASES} >> ${TEMP_ALIASES}
       mv -f ${TEMP_ALIASES} ${ALIASES}
       chown mail:mail ${ALIASES}

addalias postmaster
addalias webmaster
addalias abuse

exit 0;

chmod the script to 755:

chmod 755 /usr/local/directadmin/scripts/custom/

You can add more lines, in addition to the postmaster entry to add more aliases by default.

If you wish to apply this to existing domains, you can create the script


and add the code:

for u in `ls /usr/local/directadmin/data/users`; do
   for d in `cat /usr/local/directadmin/data/users/${u}/domains.list`; do
       domain=$d username=$u /usr/local/directadmin/scripts/custom/
exit 0;

chmod the to 755 as well, then run it:

cd /root
chmod 755

Was this answer helpful?

Also Read