Adding specific forwarders by default

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » Email

Adding specific forwarders by defaultLast Modified: Apr 18, 2016, 2:21 pm
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

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST