protected override void LoadList() { listAliases.Items.Clear(); hMailServer.Links links = APICreator.Links; hMailServer.Domain domain = links.get_Domain(_domainID); Marshal.ReleaseComObject(links); hMailServer.Aliases aliases = domain.Aliases; Marshal.ReleaseComObject(domain); for (int i = 0; i < aliases.Count; i++) { hMailServer.Alias alias = aliases[i]; ListViewItem item = listAliases.Items.Add(alias.Name); item.SubItems.Add(alias.Value); item.SubItems.Add(EnumStrings.GetYesNoString(alias.Active)); item.Tag = alias.ID; Marshal.ReleaseComObject(alias); } Marshal.ReleaseComObject(aliases); }
public void TestAliasLink() { hMailServer.Alias alias = SingletonProvider <Utilities> .Instance.AddAlias(_domain, "mytest", "test2"); Assert.AreEqual(alias.Value, _links.get_Alias(alias.ID).Value); }
public hMailServer.Alias AddAlias(hMailServer.Domain domain, string sName, string sValue) { hMailServer.Alias oAlias = domain.Aliases.Add(); oAlias.Name = sName; oAlias.Value = sValue; oAlias.Active = true; oAlias.Save(); return(oAlias); }
public void TestAlias() { hMailServer.Alias oAlias = SingletonProvider <Utilities> .Instance.AddAlias(_domain, "fr'*****@*****.**", "to@t'st.com"); if (oAlias.ID == 0) { throw new Exception("Account not properly saved"); } _domain.Aliases.DeleteByDBID(oAlias.ID); }
public void TestCaseInsensitivtyAlias() { hMailServer.Account testAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); hMailServer.Alias testAlias = SingletonProvider <Utilities> .Instance.AddAlias(_domain, "*****@*****.**", "*****@*****.**"); SMTPClientSimulator oSMTP = new SMTPClientSimulator(); string upperCase = testAlias.Name.ToUpper(); Assert.IsTrue(oSMTP.Send("*****@*****.**", upperCase, "test mail", "test body")); POP3Simulator.AssertMessageCount("*****@*****.**", "test", 1); }
public void OnDeleteObject(object sender, EventArgs args) { hMailServer.Links links = APICreator.Links; hMailServer.Alias alias = links.get_Alias(_aliasID); if (Utility.AskDeleteItem(alias.Name)) { alias.Delete(); Marshal.ReleaseComObject(links); Marshal.ReleaseComObject(alias); Instances.MainForm.RefreshParentNode(); } }
public bool SaveData() { bool newObject = false; if (representedObject == null) { hMailServer.Domain domain = APICreator.GetDomain(_domainID); hMailServer.Aliases aliases = domain.Aliases; representedObject = aliases.Add(); newObject = true; Marshal.ReleaseComObject(domain); Marshal.ReleaseComObject(aliases); } representedObject.Name = textName.Text; representedObject.Value = textValue.Text; representedObject.Active = checkEnabled.Checked; representedObject.Save(); // Refresh the node in the tree if the name has changed. IMainForm mainForm = Instances.MainForm; mainForm.RefreshCurrentNode(representedObject.Name); // Set the object to clean. DirtyChecker.SetClean(this); if (newObject) { SearchNodeText crit = new SearchNodeText(representedObject.Name); mainForm.SelectNode(crit); } return(true); }
public ucAlias(int domainID, int aliasID) { InitializeComponent(); _domainID = domainID; hMailServer.Domain domain = APICreator.GetDomain(domainID); if (aliasID > 0) { hMailServer.Aliases aliases = domain.Aliases; representedObject = aliases.get_ItemByDBID(aliasID); Marshal.ReleaseComObject(aliases); } textName.Text = "@" + domain.Name; Marshal.ReleaseComObject(domain); DirtyChecker.SubscribeToChange(this, OnContentChanged); new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); }
public bool SaveData() { bool newObject = false; if (representedObject == null) { hMailServer.Domain domain = APICreator.GetDomain(_domainID); hMailServer.Aliases aliases = domain.Aliases; representedObject = aliases.Add(); newObject = true; Marshal.ReleaseComObject(domain); Marshal.ReleaseComObject(aliases); } representedObject.Name = textName.Text; representedObject.Value = textValue.Text; representedObject.Active = checkEnabled.Checked; representedObject.Save(); // Refresh the node in the tree if the name has changed. IMainForm mainForm = Instances.MainForm; mainForm.RefreshCurrentNode(representedObject.Name); // Set the object to clean. DirtyChecker.SetClean(this); if (newObject) { SearchNodeText crit = new SearchNodeText(representedObject.Name); mainForm.SelectNode(crit); } return true; }
private void ConfirmAliasObject() { hMailServer.Alias alias = _application.Domains[0].Aliases[0]; Assert.AreEqual("*****@*****.**", alias.Name); Assert.AreEqual("*****@*****.**", alias.Value); }
private void SetupAliasObject(hMailServer.Domain domain) { hMailServer.Alias alias = SingletonProvider <Utilities> .Instance.AddAlias(domain, "*****@*****.**", "*****@*****.**"); }
internal Alias(hMailServer.Alias o) { _object = o; }