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");
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 3
0
 // 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);
 }
Exemplo n.º 4
0
 // 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);
 }
Exemplo n.º 5
0
 // 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);
 }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 // 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);
     }
 }
Exemplo n.º 8
0
 public new void SetUp()
 {
     _account = SingletonProvider <TestSetup> .Instance.AddAccount(_domain, "*****@*****.**", "test");
 }
Exemplo n.º 9
0
 public new void SetUp()
 {
     _account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");
 }