Here hope it helps
This should help you:
&?
if ($submit){
//Username, root directory NO TRAILING SLASH
$home_directory = &/home/username&;
// Mailbox path
$mail_path = &$home_directory/mail&;
$p_directory = &$home_directory/etc&;
$newuser = &$formusername&;
$usrPassword = &$formpass&;
chmod (&$p_directory/passwd&, 0755);
chmod (&$p_directory/shadow&, 0755);
chmod (&$p_directory/quota&, 0755);
if (is_dir(&$mail_path/$newuser&

){ echo &username taken, please try again&; die; }
mkdir (&$mail_path/$newuser&,0770);
mkdir (&$mail_path/$newuser/uploads&,0770);
mkdir (&$mail_path/$newuser/addressbook&,0770);
$mailfile = fopen(&$p_directory/passwd&,'a');
$shadowfile = fopen(&$p_directory/shadow&,'a');
$quotafile = fopen(&$p_directory/quota&,'a');
$mail = &$newuser:x:xxxxx:xxx::$home_directory:/bin/bash\n&;
$shadow = &$newuser:& . crypt($usrPassword, $usrPassword) . &:::::::\n&;
// convert quota to bytes, If you dont want them to set there own quota you can delete the $formquota variable, and put in a figure, ie. 5 and then remove the form compontent, allowing you to add quota.
$formquot = $formquota * 1048576;
$quota = &$newuser:$formquot&;
fputs($mailfile, $mail);
fputs($shadowfile, $shadow);
fputs($quotafile, $quota);
fclose($quotafile);
fclose($mailfile);
fclose($shadowfile);
echo &Account Created Successfully!&;
}
else
{
?&
&html&
&center&&h4&Create New Mail User&/h4&&p&
&form method=post&
Username: &input type=text name=formusername&&br&
Password: &input type=password name=formpass&&br&
Quota in MB: &input type=text name=formquota&&br&
&input type=submit name=submit value=Submit&
&?
}
?&
Hope that helps you. I didnt write the script, someone called James did, I cant quive youa n other details as I dont ahve them