PDA

View Full Version : create mail account upon domain creation



Duboux
02-05-2011, 01:15 PM
Hi,

I've been searching long and hard to have DA automatically create a 2nd mail account for a user. For example mail@domain.com
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.

DirectAdmin Support
02-08-2011, 12:35 AM
Hello,

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


#!/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

Duboux
02-08-2011, 03:08 AM
Excelent, it works ! thank you !