create mail account upon domain creation

Duboux

Verified User
Joined
Apr 20, 2007
Messages
244
Hi,

I've been searching long and hard to have DA automatically create a 2nd mail account for a user. For example [email protected]
holding the password from the user account.


The only thing I've found out is how to create a forwarder.
But I had no luck discovering how to create a mail account.
And that I'll probably need to write this in:
/usr/local/directadmin/scripts/custom/domain_create_post.sh

Could anyone help me out ?


ps, it would maybe be a nice add on to DA panel for admins and resellers, to edit files like these, or have a nice UI for easy creation.
 
Hello,

I haven't tested this, but it would be something like:
/usr/local/directadmin/scripts/custom/domain_create_post.sh

Code:
#!/bin/sh
MUSER=mail
PASS=`cat /home/$username/.shadow`
MUID=`id -u $username`
MGID=`id -g mail`
MDIR=/home/$username/imap/$domain/$MUSER
echo "$MUSER:$PASS:$MUID:$MGID::$MDIR:/bin/false" >> /etc/virtual/$domain/passwd

mkdir -p $MDIR/Maildir
chown -R $username:mail $MDIR
chmod -R 770 $MDIR
exit 0;
John
 
Back
Top