Beispiel #1
0
        public ucAccount(int domainID, int accountID)
        {
            InitializeComponent();

            _domainID = domainID;

            hMailServer.Links links = APICreator.Links;

            hMailServer.Domain domain = links.get_Domain(_domainID);

            if (accountID > 0)
            {
                _representedAccount = links.get_Account(accountID);
            }

            textAddress.Text = "@" + domain.Name;

            Marshal.ReleaseComObject(domain);
            Marshal.ReleaseComObject(links);

            comboAdministrationLevel.AddItem(InternalNames.GetAdministrationLevelName(eAdminLevel.hAdminLevelNormal), eAdminLevel.hAdminLevelNormal);
            comboAdministrationLevel.AddItem(InternalNames.GetAdministrationLevelName(eAdminLevel.hAdminLevelDomainAdmin), eAdminLevel.hAdminLevelDomainAdmin);
            comboAdministrationLevel.AddItem(InternalNames.GetAdministrationLevelName(eAdminLevel.hAdminLevelServerAdmin), eAdminLevel.hAdminLevelServerAdmin);
            comboAdministrationLevel.SelectedIndex = 0;

            dateVacationMessageExpiresDate.Value = DateTime.Now;

            DirtyChecker.SubscribeToChange(this, OnContentChanged);
            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
        }
        public new void SetUp()
        {
            Utilities.AssertSpamAssassinIsRunning();

            // Enable spam assassin
            application = SingletonProvider<Utilities>.Instance.GetApp();
            hMailServer.AntiSpam antiSpam = _settings.AntiSpam;
            ;
            account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");

            // Disallow incorrect line endings.
            antiSpam.SpamMarkThreshold = 1;
            antiSpam.SpamDeleteThreshold = 10000;
            antiSpam.AddHeaderReason = true;
            antiSpam.AddHeaderSpam = true;
            antiSpam.PrependSubject = true;
            antiSpam.PrependSubjectText = "ThisIsSpam";

            // Enable SpamAssassin
            antiSpam.SpamAssassinEnabled = true;
            antiSpam.SpamAssassinHost = "localhost";
            antiSpam.SpamAssassinPort = 783;
            antiSpam.SpamAssassinMergeScore = false;
            antiSpam.SpamAssassinScore = 5;
        }
 public new void SetUp()
 {
     _queue = _application.GlobalObjects.DeliveryQueue;
      _status = _application.Status;
      // add an account to send from
      _account = SingletonProvider<Utilities>.Instance.AddAccount(_domain, "*****@*****.**", "test");
 }
 public new void SetUp()
 {
     _account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "*****@*****.**", "test");
 }
Beispiel #5
0
        public bool SaveData()
        {
            if (!ValidateForm())
            {
                return false;
            }

            bool newAccount = false;

            if (_representedAccount == null)
            {
                hMailServer.Domain domain = APICreator.GetDomain(_domainID);

                hMailServer.Accounts accounts = domain.Accounts;
                _representedAccount = accounts.Add();

                Marshal.ReleaseComObject(accounts);
                Marshal.ReleaseComObject(domain);
            }

            if (_representedAccount.ID == 0)
                newAccount = true;

            _representedAccount.Address = textAddress.Text;
            _representedAccount.MaxSize = textMaxSize.Number;
            _representedAccount.Active = checkEnabled.Checked;

            _representedAccount.VacationMessageIsOn = checkVacationMessageEnable.Checked;
            _representedAccount.VacationSubject = textVacationMessageSubject.Text;
            _representedAccount.VacationMessage = textVacationMessageText.Text;
            _representedAccount.VacationMessageExpires = checkVacationMessageExpires.Checked;
            _representedAccount.VacationMessageExpiresDate = dateVacationMessageExpiresDate.FormattedValue;

            _representedAccount.ForwardEnabled = checkForwardEnabled.Checked;
            _representedAccount.ForwardAddress = textForwardAddress.Text;
            _representedAccount.ForwardKeepOriginal = checkForwardKeepOriginal.Checked;

            _representedAccount.SignatureEnabled = checkSignatureEnabled.Checked;
            _representedAccount.SignaturePlainText = textSignaturePlainText.Text;
            _representedAccount.SignatureHTML = textSignatureHTML.Text;

            _representedAccount.IsAD = checkAccountIsAD.Checked;
            _representedAccount.ADDomain = textADDomain.Text;
            _representedAccount.ADUsername = textADUsername.Text;

            _representedAccount.PersonFirstName = textFirstName.Text;
            _representedAccount.PersonLastName = textLastName.Text;
            _representedAccount.AdminLevel = (hMailServer.eAdminLevel)comboAdministrationLevel.SelectedValue;

            if (textPassword.Dirty)
                _representedAccount.Password = textPassword.Password;

            _representedAccount.Save();

            // Refresh the node in the tree if the name has changed.
            IMainForm mainForm = Instances.MainForm;
            mainForm.RefreshCurrentNode(_representedAccount.Address);

            // Set the object to clean.
            DirtyChecker.SetClean(this);

            if (newAccount)
            {
                SearchNodeText crit = new SearchNodeText(_representedAccount.Address);
                mainForm.SelectNode(crit);
            }
            else
                EnableDisable();

            return true;
        }
 internal Account(hMailServer.Account o)
 {
     _object = o;
 }