PDA

View Full Version : vpopmail:Creating accounts from remote server w/http-request


activealli
03-23-2004, 10:27 PM
Hello, I run a website on a windows platform, and I want to be able to create vpopmail accounts on my newly set up. qmail-vpopmail-courier-squirelmail debain mailserver.

Do you guys know of any good way to go about this, I wan't to make a 'behind the scenes' HTTP-Request to my mailserver, with the username/password/domain to add (vadduser).

I mocked about with a php script that uses shell_exec on vadduser. and after granting just about everbody all permissions to the /home/vpopmail/domains folder and subfolders I finally came to an error that I couldn't resolve; vadduser returned no auth connection.


<?
foreach($_GET AS $key=>$value){
$_GET[$key] = strip_tags(addslashes($value));
}

if ($secret != 'myBigSecretThatNoOneKnows'){
echo 'noway';
exit;
}
if (strlen($username) > 0 && strlen($password) > 0) {

if (strpos($username, "@mydomain.com") === false) {
$username=$username.'@mydomain.com';
}

$command = '/home/vpopmail/bin/./vadduser -q2097152 '.$username.' '.$password;
$output = shell_exec($command);

if (strlen($output)>0) {
echo $output;
exit;
}else{
echo 'success';
exit;
}
}else{
echo 'missing input error';
exit;
}

?>


Any help on this would be much apreciated.

Bookworm
03-23-2004, 11:48 PM
You might want to go to the Inter7 web site, I think they have something like that already done as an add-on to vpopmail.

Also, is the 'add new email account' in qmailadmin not enough?

(might hack the qmailadmin scripts a bit, then)

BW

activealli
03-24-2004, 06:17 AM
Yes, well the qmailadmin scripts are just one big cg-bin file, seems to be compiled, and I can't really hack it.

qmailadmin does not use http-auth to authenticate, so I couldn't use that.

But then i figured out that you can add users with the vqadmin scripts and they use http-auth. so that worked !

Wow I can do something like this remotely to add accounts, and I am a very happy camper:

http://admin:myPassword@mail.mydomain.com/cgi-bin/vqadmin/vqadmin.cgi?nav=add_user&eaddr=username@mydomain.c om&cpass=pass123&quota=2097152&fname=Full+Name

Thanks for the help, it was after I visited Inter7 that I realized this!