// Domain activation or deactivation private static bool DomainActivate(string userName, string password, string domainName, bool active = true) { hMailServer.Application hMailApp = Authenticate(userName, password); hMailServer.Domain myDomain = hMailApp.Domains.ItemByName[domainName]; myDomain.Active = active; myDomain.Save(); return(true); }
// Domain set catchall mailbox private static bool DomainActivateCatchAll(string userName, string password, string domainName, string mailboxEmail = "catchall", bool active = true) { hMailServer.Application hMailApp = Authenticate(userName, password); hMailServer.Domain myDomain = hMailApp.Domains.ItemByName[domainName]; myDomain.Active = active; myDomain.Postmaster = mailboxEmail + "@" + domainName; myDomain.Save(); return(true); }
// Change Account mailbox password private static bool ChangAccountPassword(string userName, string password, string domainName, string accountAddress, string newPassword) { hMailServer.Application hMailApp = Authenticate(userName, password); hMailServer.Domain myDomain = hMailApp.Domains.ItemByName[domainName]; hMailServer.Account account = myDomain.Accounts.ItemByAddress[accountAddress]; account.Password = newPassword; myDomain.Save(); return(true); }
// Create new domain private static bool DomainCreate(string user, string pass, string domainName) { hMailServer.Application hMailApp = Authenticate(user, pass); hMailServer.Domain domain = hMailApp.Domains.Add(); domain.Name = domainName; domain.Postmaster = "catchall@" + domainName; // add catch all address, mailbox domain.Active = true; domain.Save(); return(true); }