\n"; if (!empty($_POST[submit])) { $username = $_POST[username]; $password = $_POST[password]; $password2 = $_POST[password2]; $name = $_POST[name]; $username = $username . "@" . $sessid[domain]; $passwd = md5crypt ("$password"); $maildir = $username . "/"; if (empty($username) or empty($password)) { print "

\n"; print "You need to fill all fields.\n"; print_footer(); exit; } if (!check_email($username)) { print "

\n"; print "The email address that you have supplied at Email is not a valid email address, please go back.\n"; print_footer(); exit; } if ($password != $password2) { print "

\n"; print "The passwords that you supplied don't match!\n"; print_footer(); exit; } if (!check_string($name)) { print "

\n"; print "The name that you have supplied at Name is not valid, please go back.\n"; print_footer(); exit; } $result = db_query ("SELECT * FROM alias WHERE address='$username'"); if ($result[rows] == 1) { print "

\n"; print "This email address already exists, please choose a different one.\n"; print_footer(); exit; } $result = db_query ("INSERT INTO alias (address,goto,domain,create_date,change_date) VALUES('$username','$username','$sessid[domain]',NOW(),NOW())"); if ($result[rows] != 1) { print "

\n"; print "Unable to add: $username to the alias table!\n"; print_footer(); exit; } $result = db_query ("INSERT INTO mailbox (username,password,name,maildir,domain,create_date,change_date) VALUES('$username','$passwd','$name','$maildir','$sessid[domain]',NOW(),NOW())"); if ($result[rows] == 1) { $headers = "From: $sessid[username]"; $subject = "Welcome"; $message = "Hi $name,\n\nWelcome to your new email account.\n\n"; print "$username has been added to the mailbox table!\n"; print "

\n"; print "NOTE:\n"; if (!mail($username, $subject, $message, $headers)) { print "The user needs to first receive an email in order to use the account.
\n"; } print "User needs to login with the full email address, in this case: $username\n"; print "

\n"; } else { print "

\n"; print "Unable to add: $username to the mailbox table!\n"; print_footer(); exit; } } ?> Create a new local mailbox for your domain.

Email:@
Password:Password for POP/IMAP
Password (again):
Name:Full name