2013-10-14 28 views

回答

1

Interface Domain指定屬性Postmaster。這是一個字符串,其中包含一個帳戶的地址,該帳戶應該用作該域的全部內容。

例子:

public void SetDomainCatchAll(String domainName, String catchAllAddress) 
{ 
    String myUserName = "MyUserName"; 
    String myPassword = "MyPasword"; 

    // get hMailServer application instance 
    Application app = new ApplicationClass(); 
    app.Authenticate(myUserName, myPassword); 

    // check that domain and account exist 
    Domain domain = app.Domains.get_ItemByName(domainName); 
    Account account = domain.Accounts.get_ItemByAddress(catchAllAddress); 

    // set postmaster and save changes 
    domain.Postmaster = account.Address; 
    domain.Save(); 
} 

當然,這是一個沒有錯誤檢查或任何東西很粗糙的代碼,但我希望它表明你,你想知道什麼。如果您以後使用管理程序,則可以檢查域名條目的高級選項卡中已成功設置捕獲全部地址。

我在hMailServer版本5.4-B1950上測試了這個。

相關問題