Beispiel #1
0
        private ServerData GetMailServer(IDaoFactory daoFactory)
        {
            var linkedServer = GetOrCreate(daoFactory);

            var dns = GetOrCreateUnusedDnsData(daoFactory, linkedServer);

            var mailboxServerDao = daoFactory.CreateMailboxServerDao();

            var inServer  = mailboxServerDao.GetServer(linkedServer.ImapSettingsId);
            var outServer = mailboxServerDao.GetServer(linkedServer.SmtpSettingsId);

            return(new ServerData
            {
                Id = linkedServer.Id,
                Dns = dns,
                ServerLimits = new ServerLimitData
                {
                    MailboxMaxCountPerUser = Defines.ServerDomainMailboxPerUserLimit
                },
                InServer = inServer,
                OutServer = outServer
            });
        }
        private static Tuple <MailBoxData, Mailbox> GetMailbox(IDaoFactory daoFactory, Mailbox mailbox)
        {
            var daoMailboxServer = daoFactory.CreateMailboxServerDao();

            var inServer = daoMailboxServer.GetServer(mailbox.ServerId);

            if (inServer == null)
            {
                return(null);
            }

            var outServer = daoMailboxServer.GetServer(mailbox.SmtpServerId);

            if (outServer == null)
            {
                return(null);
            }

            var daoMailboxAutoreply = daoFactory.CreateMailboxAutoreplyDao(mailbox.Tenant, mailbox.User);

            var autoreply = daoMailboxAutoreply.GetAutoreply(mailbox.Id);

            return(new Tuple <MailBoxData, Mailbox>(ToMailBoxData(mailbox, inServer, outServer, autoreply), mailbox));
        }