in the tutorial before, we share how to install rainloop webmail for tour directadmin. But unfortunately, rainloop still need to add domain one by one. How to add domain automaticaly ?

To add domain automaticaly, you must add hook scripts:
1. domain_create_post.sh to add domain
2. domain_destroy_post.sh to remove domain

to create domain_create_post.sh you can type:

vim /usr/local/directadmin/scripts/custom/domain_create_post.sh

and type this:

#!/bin/sh
namadomain="/var/www/html/rainloop/data/_data_/_default_/domains/"$domain".ini"
touch $namadomain
echo 'imap_host = "yourhostnamehere"' >> $namadomain
echo 'imap_port = 993' >> $namadomain
echo 'imap_secure = "SSL"' >> $namadomain
echo 'imap_short_login = Off' >> $namadomain
echo 'sieve_use = Off' >> $namadomain
echo 'sieve_allow_raw = Off' >> $namadomain
echo 'sieve_host = ""' >> $namadomain
echo 'sieve_port = 4190' >> $namadomain
echo 'sieve_secure = "None"' >> $namadomain
echo 'smtp_host = "jkt-server01.directadminpanel.com"' >> $namadomain
echo 'smtp_port = 465' >> $namadomain
echo 'smtp_secure = "SSL"' >> $namadomain
echo 'smtp_short_login = Off' >> $namadomain
echo 'smtp_auth = On' >> $namadomain
echo 'smtp_php_mail = Off' >> $namadomain
echo 'white_list = ""' >> $namadomain
chown webapps: $namadomain

Set own and chmod:

chmod 700 /usr/local/directadmin/scripts/custom/domain_create_post.sh
chown diradmin: /usr/local/directadmin/scripts/custom/domain_create_post.sh

To add destroy domain hook, create domain_destroy_post.sh :

vim /usr/local/directadmin/scripts/custom/domain_destroy_post.sh

and fill with this:

#!/bin/sh
namadomain="/var/www/html/rainloop/data/_data_/_default_/domains/"$domain".ini"
rm -f $namadomain

Set own and chmod:

chmod 700 /usr/local/directadmin/scripts/custom/domain_destroy_post.sh
chown diradmin: /usr/local/directadmin/scripts/custom/domain_destroy_post.sh

Write A Comment