我们正在编写一个专门的PHP电子邮件客户端,并希望该客户端的管理员能够在hMailServer上创建用户帐户。
我尝试了imap_createmailbox(...),但它只是在用户的文件夹结构中创建了一个目录,但并不像我们所希望的那样“为新用户创建一个邮箱”。
,hMailServer是否有某种接口,这样我就可以让我们的PHP电子邮件客户端通过代码?创建hMailServer帐户。
发布于 2015-07-15 23:39:08
是的,有两个接口可以在hmailserver中创建帐户。
第一,通过数据库,您可以选择帐户和密码哈希类型(0,1,2,3)以及签名和其他经典信息。出于同步的原因,我不推荐这种方法,hmail-server需要缓存时间来考虑数据库的更新。
第二,我建议使用API COM,它提供了所有孜然语言中的所有可能方法。您必须在windows服务器中启用D。API 指南
发布于 2015-12-17 04:51:40
hmailserver版本: hMailServer 5.6.4 -在c#中通过hmailserver创建新电子邮件帐户的完整解决方案(如果已成功配置hmailserver ),则可以使用以下步骤在c#中通过hmailserver创建新帐户
见链接
我测试过了。
发布于 2019-07-20 10:40:51
<?php
header('Content-Type: text/html; charset=utf-8');
$obBaseApp = new COM("hMailServer.Application", NULL, CP_UTF8);
$obBaseApp->Connect();
$hmail_config['rooturl'] = "http://localhost/";
$obAccount = $obBaseApp->Authenticate("Administrator", "hMailserver Administrator
password");
if (!isset($obAccount)) {
echo "<b>Not authenticated or Administrator's password wrong</b>";
} else {
try {
echo "<b>Logon COM [OK], now we can add accounts</b>";
$obDomain = $obBaseApp->Domains->ItemByDBID(1);
$obAccount = $obDomain->Accounts->ItemByDBID(1); // account id
$domainname = $obDomain->Name;
$obAccounts = $obDomain->Accounts();
$obAccount = $obDomain->Accounts->Add();
$newalias = "powerranger";
$firstname = "Arnold";
$lastname = "Schwarzenegger";
$my_domainname ="@mydomain.com";
$obAccount->PersonFirstName = $firstname;
$obAccount->PersonLastName = $lastname;
$obAccount->MaxSize = 102; // 102 MB set inbox space
$obAccount->Address = $newalias .$my_domainname;
$obAccount->Password = "secret"; // provide this in Thunderbird/Outlook ect.
$obAccount->Active = true; // set account to active
$obAccount->Save(); // save, finish.
/* If we reaching this point, everything works as expected */
echo "<br/><h3> Account was successfully created, now you can login with".
"an POP3 or IMAP-Client </h3>";
}
/* OK, if something went wrong, give us the exact error details */
catch(Exception $e) {
echo "<h4>COM-ERROR: <br />".$e->getMessage()."</h4><br />";
}}
https://stackoverflow.com/questions/31432102
复制相似问题