0

我需要帮助创建一个脚本或程序,以便在用户注册表格时将其添加到我的 Merge 邮件服务器。我使用的是基本的 php 发布表单,它确实创建了运行帐户所需的所有文件,但是当我打开水银邮件时,新用户帐户尚未添加到帐户列表中。并且新帐户无法登录。

请协助我创建客户电子邮件注册脚本或程序,以便我的客户可以轻松地在我的服务器上免费创建电子邮件。

表格代码链接:http: //pastebin.com/bEtv4eck

链接到 php 邮政编码: http: //pastebin.com/rwBJatap

PS我有脚本可以创建新用户和所有内容,但除非重新启动电子邮件服务器,否则它不允许登录。有任何解决这个问题的方法吗?

4

2 回答 2

0

您还需要在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 );
于 2012-04-13T05:00:30.303 回答
0

在对 pmail.usr 和 mail, 目录进行更改后尝试使用 RELOAD USERS。

于 2012-04-14T05:09:10.033 回答