public hMailServer.Domain AddDomain(hMailServer.Domains oDomains, string sName) { hMailServer.Domain oDomain = oDomains.Add(); oDomain.Name = sName; oDomain.Active = true; oDomain.Save(); return(oDomain); }
public bool SaveData() { if (_domain == null) { hMailServer.Domains domains = _application.Domains; _domain = domains.Add(); Marshal.ReleaseComObject(domains); } _domain.Name = textDomainName.Text; _domain.Postmaster = textCatchAllAddress.Text; _domain.AddSignaturesToReplies = checkAddSignaturesToReplies.Checked; _domain.AddSignaturesToLocalMail = checkAddSignaturesToLocalMail.Checked; _domain.SignatureEnabled = checkSignatureEnabled.Checked; _domain.Active = checkEnabled.Checked; if (radioSMAppendToAccountSignature.Checked == true) { _domain.SignatureMethod = eDomainSignatureMethod.eSMAppendToAccountSignature; } else if (radioSMOverwriteAccountSignature.Checked == true) { _domain.SignatureMethod = eDomainSignatureMethod.eSMOverwriteAccountSignature; } else if (radioSMSetIfNotSpecifiedInAccount.Checked == true) { _domain.SignatureMethod = eDomainSignatureMethod.eSMSetIfNotSpecifiedInAccount; } _domain.MaxSize = textMaxSize.Number; _domain.MaxMessageSize = textMaxMessageSize.Number; _domain.MaxAccountSize = textMaxAccountSize.Number; _domain.MaxNumberOfAccounts = textMaxNumberOfAccounts.Number; _domain.MaxNumberOfAliases = textMaxNumberOfAliases.Number; _domain.MaxNumberOfDistributionLists = textMaxNumberOfDistributionLists.Number; _domain.MaxNumberOfAccountsEnabled = checkMaxNumberOfAccountsEnabled.Checked; _domain.MaxNumberOfAliasesEnabled = checkMaxNumberOfAliasesEnabled.Checked; _domain.MaxNumberOfDistributionListsEnabled = checkMaxNumberOfDistributionListsEnabled.Checked; _domain.SignaturePlainText = textPlainTextSignature.Text; _domain.SignatureHTML = textHTMLSignature.Text; _domain.PlusAddressingEnabled = checkUsePlusAddressing.Checked; _domain.PlusAddressingCharacter = comboPlusAddressingCharacter.Text; _domain.AntiSpamEnableGreylisting = checkGreyListingEnabled.Checked; _domain.DKIMSignEnabled = checkDKIMSignEnabled.Checked; _domain.DKIMPrivateKeyFile = textDKIMPrivateKeyFile.Text; _domain.DKIMSelector = textDKIMSelector.Text; if (radioDKIMHeaderMethodSimple.Checked) { _domain.DKIMHeaderCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationSimple; } else if (radioDKIMHeaderMethodRelaxed.Checked) { _domain.DKIMHeaderCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationRelaxed; } if (radioDKIMBodyMethodSimple.Checked) { _domain.DKIMBodyCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationSimple; } else if (radioDKIMBodyMethodRelaxed.Checked) { _domain.DKIMBodyCanonicalizationMethod = eDKIMCanonicalizationMethod.eCanonicalizationRelaxed; } if (radioDKIMSigningAlgorithmSHA1.Checked) { _domain.DKIMSigningAlgorithm = eDKIMAlgorithm.eSHA1; } else if (radioDKIMSigningAlgorithmSHA256.Checked) { _domain.DKIMSigningAlgorithm = eDKIMAlgorithm.eSHA256; } try { _domain.Save(); } catch (Exception ex) { MessageBox.Show(Strings.Localize(ex.Message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } IMainForm mainForm = Instances.MainForm; // Refresh the node in the tree mainForm.RefreshCurrentNode(_domain.Name); // Set the object to clean. DirtyChecker.SetClean(this); SearchNodeText crit = new SearchNodeText(_domain.Name); mainForm.SelectNode(crit); EnableDisableTabs(); return(true); }
public IDomain Add() { return(new Domain(_object.Add())); }