您需要在PMAIL.USR
文件還添加用戶
嘗試
const MERCURY_PATH = 'C:\Apache\xampp\MercuryMail';
$userFile = MERCURY_PATH . DIRECTORY_SEPARATOR . "PMAIL.USR";
$mailDir = MERCURY_PATH . DIRECTORY_SEPARATOR . "MAIL";
$newName = "Baba Konko";
$newUsername = "baba";
$newPassword = "pass";
$host = "localhost";
if (! is_writeable ($userFile)) {
die ("You don't have permission to Create new User");
}
if (! is_writeable ($mailDir)) {
die ("You don't have permission to add mail folder");
}
// Check if user exist
if (is_file ($userFile)) {
$users = file ($userFile);
foreach ($users as $user) {
list ($status, $username, $name) = explode (";", strtolower ($user));
if (strtolower ($newUsername) == $username) {
die ("User Already Exist");
}
}
}
$userData = "U;$newUsername;$newName";
$fp = fopen ($userFile, "a");
if ($fp) {
fwrite ($fp, $userData . chr (10));
fclose ($fp);
}
$folder = $mailDir . DIRECTORY_SEPARATOR . $newUsername;
if (! mkdir ($folder)) {
die ("Error Creating Folder");
}
$pm = '# Mercury/32 User Information File' . chr (10);
$pm .= 'POP3_access: ' . $newPassword . chr (10);
$pm .= 'APOP_secret: ' . $newPassword . chr (10);
$pmFile = $folder . DIRECTORY_SEPARATOR . 'PASSWD.PM';
file_put_contents ($pmFile, $pm);
RELOAD用戶?我如何讓它做到這一點? – 2012-04-15 21:19:41
我使用的是這裏提供的腳本:http://community.pmail.com/files/folders/community_add-ons_for_mercury/entry17424.aspx 但是當它嘗試在腳本內發送郵件時,它說在水銀郵件軟件中失敗系統 – 2012-04-16 05:58:57