Jump to content

IMAP + PHP + Create New User Account


HDFilmMaker2112

Recommended Posts

here i found this awhile back and i used it and it worked

<?php
// Domain Logon Details
$username="";
$password="";

// Domain details
$domain="www.xxxxx.com";
$theme="xxxxx";//eg "fantastico_bluelagoon";

// Parameters to parse
$eEmail="";
$eDomain="xxxxx.com";
$ePassword="";
$eQuota=""; // eg"10";

// Put post fields variable together
$postfields = "email=$eEmail&domain=$eDomain&password=$ePassword&quota=$eQuota";

// initialise Curl
$popPost = curl_init();

// Set Curl Option: URL
$url="http://$domain:2082/frontend/$theme/mail/doaddpop.html";
curl_setopt($popPost, CURLOPT_URL, $url);

// Set Curl Option: Username:Password
curl_setopt($popPost, CURLOPT_USERPWD, "$username:$password");

// Set Curl Option: Post style request = true
curl_setopt($popPost, CURLOPT_POST, 1);

// Set Curl Option: Collect result from script
curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1);

// Set Curl Option: Set timeout to 15 seconds
curl_setopt($popPost, CURLOPT_TIMEOUT, 15);

// Set Curl Option: Post data
curl_setopt($popPost, CURLOPT_POSTFIELDS, $postfields);

// Execute Request, and store result in $tb_post
$popPost_result = curl_exec ($popPost);

// Close Curl
curl_close ($popPost);

      //output results
      $start = strpos($popPost_result, '<b>Account');
      $end = strpos($popPost_result, 'created.');
      $subset = substr($popPost_result, $start, $end+8-$start);
      $subset = str_replace('login ', "login<br>", $subset); //for neatness
      //$subset=str_replace("<!",'<-',$subset); //see the comments
      if (preg_match ('/Sorry/i', "$subset")) {
          print "<br><b>   Sorry that account already exists.</b><br><br>";
          //print ($subset);
      } elseif(preg_match ('/You must specify/i', "$subset")) {
          print "<br><b>You must specify a password.</b><br><br>";
      } else {
          print ($subset);
          print "<br><br>You may now use <b>mail.$domain</b> as your POP3 setting in your mail client or access <b>WebMail</b> by selecting <a href=http://$domain/webmail>Here</a>.
              <center>
              <br><a href=javascript:history.go(-1)>Go Back</a>
              </center>";
      }
?>
[/code[

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.