ที่ผมเจอมันมี function ของ vpopmail นะครับแต่ผมก็ไม่มีตัว extension ใครรู้วิช่วยบอกหน่อยนะครับ
Tag : - - - -
Date :
29 มิ.ย. 2550 11:03:39
By :
bbm
View :
1630
Reply :
1
No. 1
Guest
Code (PHP)
<?php
/*
Simple example of creating a pop account using a PHP script
*/
// Domain Logon Details
$username="xxxxx";
$password="xxxxx";
// Domain details
$domain="www.xxxxx.com";
$theme="xxxxx";//eg "fantastico_bluelagoon";
// Parameters to parse
$eEmail="xxxxx";
$eDomain="xxxxx.com";
$ePassword="xxxxxx";
$eQuota="xx"; // eg"10";
// Put post fields variable together
$postfields = "email=$eEmail&domain=$eDomain&password=$ePassword"a=$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>";
}
?>