public new void SetUp() { bool attachmentSetUp = false; var blockedAttachments = _settings.AntiVirus.BlockedAttachments; for (int i = 0; i < blockedAttachments.Count; i++) { var ba = blockedAttachments[i]; if (ba.Wildcard == "*.dll") { attachmentSetUp = true; break; } } if (!attachmentSetUp) { var blockedAttachment = blockedAttachments.Add(); blockedAttachment.Wildcard = "*.dll"; blockedAttachment.Save(); } _settings.AntiVirus.EnableAttachmentBlocking = true; _account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test"); }
public new void SetUp() { bool attachmentSetUp = false; var blockedAttachments = _settings.AntiVirus.BlockedAttachments; for (int i = 0; i < blockedAttachments.Count; i++) { var ba = blockedAttachments[i]; if (ba.Wildcard == "*.dll") { attachmentSetUp = true; break; } } if (!attachmentSetUp) { var blockedAttachment = blockedAttachments.Add(); blockedAttachment.Wildcard = "*.dll"; blockedAttachment.Save(); } _settings.AntiVirus.EnableAttachmentBlocking = true; _account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test"); }
// Delete account mailbox private static bool AccountDelete(string userName, string password, string domainName, string accountAddress) { hMailServer.Application hMailApp = Authenticate(userName, password); hMailServer.Domain myDomain = hMailApp.Domains.ItemByName[domainName]; hMailServer.Account account = myDomain.Accounts.ItemByAddress[accountAddress]; myDomain.Accounts.DeleteByDBID(account.ID); 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); }
// Deactivate account private static bool AccountActivate(string userName, string password, string domainName, string accountAddress, bool active = true) { hMailServer.Application hMailApp = Authenticate(userName, password); hMailServer.Domain myDomain = hMailApp.Domains.ItemByName[domainName]; hMailServer.Account account = myDomain.Accounts.ItemByAddress[accountAddress]; account.Active = active; account.Save(); return(true); }
public void TestSendToManyRecipients() { // Add distribution list hMailServer.Accounts accounts = _domain.Accounts; var recipients = new List <string>(); for (int i = 0; i < 1000; i++) { hMailServer.Account account = SingletonProvider <TestSetup> .Instance.AddAccount(accounts, string.Format("recipient{0}@test.com", i), "test"); recipients.Add(account.Address); Marshal.ReleaseComObject(account); if (i % 10 == 0) { TestTracer.WriteTraceInfo("Creating accounts: {0}/{1}", i, 1000); } } Marshal.ReleaseComObject(accounts); var sw = new Stopwatch(); sw.Start(); SmtpClientSimulator.StaticSend("*****@*****.**", recipients, "Test", "Test message"); sw.Stop(); Console.WriteLine("Elapsed time: " + sw.Elapsed.TotalSeconds); string dataDir = Path.Combine(SingletonProvider <TestSetup> .Instance.GetApp().Settings.Directories.DataDirectory, "test.com"); // Check number of accounts. RetryHelper.TryAction(() => { if (IsFolderCountReached(dataDir, 1000)) { return; } throw new Exception("Not enough files in folder yet."); }, TimeSpan.FromSeconds(5), TimeSpan.FromMinutes(2)); }
// Create mailbox, Account: [email protected] private static bool AccountCreate(string userName, string password, string domainName, string accountAddress, string accountPassword, bool accountActive = true, int maxSize = 1000) { hMailServer.Application hMailApp = Authenticate(userName, password); hMailServer.Domain myDomain = hMailApp.Domains.ItemByName[domainName]; if (myDomain != null) { hMailServer.Account account = myDomain.Accounts.Add(); account.Address = accountAddress; account.Password = accountPassword; account.Active = accountActive; account.MaxSize = maxSize; account.Active = true; account.Save(); return(true); } else { return(false); } }
public new void SetUp() { _account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test"); }
public new void SetUp() { _account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test"); }