public void TestDomainAliasWithSameNameAsDomain() { hMailServer.Domains domains = SingletonProvider <Utilities> .Instance.GetApp().Domains; hMailServer.DomainAlias da = _domain.DomainAliases.Add(); da.AliasName = "test.com"; try { da.Save(); } catch (Exception) { return; } Assert.Fail("Domain alias with same name as domain was permitted."); }
public void TestGreyListingWithDomainAliases() { _antiSpam.GreyListingEnabled = false; hMailServer.Account oAccount1 = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); SMTPClientSimulator smtp = new SMTPClientSimulator(); List <string> recipients = new List <string>(); recipients.Add(oAccount1.Address); bool result = smtp.Send("*****@*****.**", recipients, "Test", "Body"); Assert.IsTrue(result); POP3Simulator.AssertGetFirstMessageText(oAccount1.Address, "test"); _antiSpam.GreyListingEnabled = true; result = smtp.Send("*****@*****.**", recipients, "Test", "Body"); Assert.IsFalse(result); _domain.AntiSpamEnableGreylisting = false; _domain.Save(); result = smtp.Send("*****@*****.**", recipients, "Test", "Body"); Assert.IsTrue(result); POP3Simulator.AssertGetFirstMessageText(oAccount1.Address, "test"); hMailServer.DomainAlias da = _domain.DomainAliases.Add(); da.AliasName = "test2.com"; da.Save(); recipients = new List <string>(); recipients.Add("*****@*****.**"); result = smtp.Send("*****@*****.**", recipients, "Test", "Body"); Assert.IsTrue(result); POP3Simulator.AssertGetFirstMessageText(oAccount1.Address, "test"); _domain.AntiSpamEnableGreylisting = true; _domain.Save(); result = smtp.Send("*****@*****.**", recipients, "Test", "Body"); Assert.IsFalse(result); }
private void SetupDomainObject(hMailServer.Domain domain) { domain.Postmaster = "*****@*****.**"; domain.SignatureEnabled = true; domain.AddSignaturesToLocalMail = true; domain.AddSignaturesToReplies = true; domain.SignaturePlainText = "PLS"; domain.SignatureHTML = "HTML"; domain.Save(); hMailServer.DomainAlias da = domain.DomainAliases.Add(); da.AliasName = "test1.com"; da.Save(); hMailServer.DomainAlias da2 = domain.DomainAliases.Add(); da2.AliasName = "test2.com"; da2.Save(); }
private void EditSelectedName() { if (listAliases.SelectedItems.Count != 1) { return; } int id = Convert.ToInt32(listAliases.SelectedItems[0].Tag); DomainAliases domainAliases = _domain.DomainAliases; hMailServer.DomainAlias da = domainAliases.get_ItemByDBID(id); formInputDialog inputDialog = new formInputDialog(); inputDialog.Title = "Alias name"; inputDialog.Text = "Enter domain alias name"; inputDialog.Value = da.AliasName; if (inputDialog.ShowDialog() == DialogResult.OK) { // Add it string value = inputDialog.Value; da.AliasName = value; try { da.Save(); } catch (Exception ex) { MessageBox.Show(Strings.Localize(ex.Message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Error); } ListDomainAliases(); } Marshal.ReleaseComObject(domainAliases); Marshal.ReleaseComObject(da); }
public void TestDomainAliases() { // Create a test account // Fetch the default domain hMailServer.DomainAlias oDomainAlias = _domain.DomainAliases.Add(); oDomainAlias.AliasName = "alias.com"; oDomainAlias.Save(); hMailServer.Account oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); // Send 5 messages to this account. SMTPClientSimulator oSMTP = new SMTPClientSimulator(); for (int i = 0; i < 5; i++) { oSMTP.Send("*****@*****.**", "*****@*****.**", "INBOX", "Alias test message"); } POP3Simulator.AssertMessageCount("*****@*****.**", "test", 5); { oAccount = SingletonProvider <Utilities> .Instance.AddAccount(_domain, "*****@*****.**", "test"); // Set up an alias pointing at the domain alias. SingletonProvider <Utilities> .Instance.AddAlias(_domain, "*****@*****.**", "*****@*****.**"); // Send to the alias for (int i = 0; i < 5; i++) { oSMTP.Send(oAccount.Address, "*****@*****.**", "INBOX", "Plus addressing message"); } // Wait for completion POP3Simulator.AssertMessageCount(oAccount.Address, "test", 5); } }
internal DomainAlias(hMailServer.DomainAlias o) { _object = o; }