Пример #1
0
 public HomeController(IDbContextWrapper context, IMatchProvider matchProvider, IEmailController emailController, IViewMessageFactory viewMessageFactory)
 {
     this.context            = context;
     this.matchProvider      = matchProvider;
     this.emailController    = emailController;
     this.viewMessageFactory = viewMessageFactory;
 }
Пример #2
0
 /// <summary>
 /// Process the specified email message.
 /// </summary>
 /// <param name="emailMessage"></param>
 /// <param name="controller"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public bool ProcessMessage(EmailMessage emailMessage, IEmailController controller, string user)
 {
     TraceFactory.Logger.Debug("Cleaning up email message From:{0}   To:{1}".FormatWith(emailMessage.FromAddress.Address, user));
     //TODO: Add Logger support
     controller.Delete(emailMessage); //Clean up the email
     return(true);
 }
Пример #3
0
        public PluginExecutionResult Execute(PluginExecutionData executionData)
        {
            try
            {
                ServerInfo exchangeServerInfo = executionData.Servers.First();

                if (!_controllerConfigured)
                {
                    // Alan Andrews 7/9/2010:
                    // For some reason, Autodiscover hangs when we do not have this VMLevelLock in place.
                    // Putting the lock in, then Autodiscover no longer hangs.  I don't quite understand why, but
                    // this is how automation goes sometimes.

                    var action = new Action(() =>
                    {
                        ExecutionServices.SystemTrace.LogDebug("Autodiscover lock acquired");
                        ExchangeConnectionSettings settings = new ExchangeConnectionSettings(exchangeServerInfo);
                        _emailController = new ExchangeEmailController(executionData.Credential, settings);
                    });

                    ExecutionServices.CriticalSection.Run(new ExchangeAutodiscoverLockToken(new TimeSpan(0, 5, 0), new TimeSpan(0, 5, 0)), action);

                    if (InvokeRequired)
                    {
                        ExecutionServices.SystemTrace.LogDebug("Invoking Load Inbox activity");
                        Invoke(new Action(LoadInbox));
                    }

                    _controllerConfigured = true;
                }

                LogUsageData(executionData, exchangeServerInfo);

                _sendActivity = executionData.GetMetadata <EmailActivityData>();
                ExecutionServices.SystemTrace.LogDebug("Activity deserialized, Preparing to send an email");

                var allRecipients = ExecutionServices.SessionRuntime.AsInternal().GetOfficeWorkerEmailAddresses(_sendActivity.ToRandomCount + _sendActivity.CCRandomCount);
                ExecutionServices.SystemTrace.LogDebug("Adding To: recipients");
                var toRecipients = allRecipients.Take(_sendActivity.ToRandomCount);
                ExecutionServices.SystemTrace.LogDebug("Adding CC: recipients");
                var ccRecipients = allRecipients.Skip(_sendActivity.ToRandomCount).Take(_sendActivity.CCRandomCount);

                PopulateControl(_sendActivity, executionData.Documents, toRecipients, ccRecipients);
                SendEmail();

                ExecutionServices.SystemTrace.LogDebug("Email sent, now sleeping 1 second");
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }
            finally
            {
                // We want to attempt an email receive, even if something goes wrong with the send
                if (_exchangeInboxControl != null)
                {
                    _exchangeInboxControl.LoadInbox();
                }
            }

            return(new PluginExecutionResult(PluginResult.Passed));
        }
        private void ConfigureEmailController(ServerInfo serverInfo, NetworkCredential credential)
        {
            Action action = new Action(() =>
            {
                ExchangeConnectionSettings settings = new ExchangeConnectionSettings(serverInfo);
                _emailController = new ExchangeEmailController(credential, settings);
            });

            // For some reason, Autodiscover hangs when we do not have this local lock in place.
            // Putting the lock in, then Autodiscover no longer hangs.
            ExecutionServices.CriticalSection.Run(new ExchangeAutodiscoverLockToken(new TimeSpan(0, 8, 0), new TimeSpan(0, 5, 0)), action);
        }
Пример #5
0
 public RegisterModel(
     UserManager <IdentityUser> userManager,
     SignInManager <IdentityUser> signInManager,
     ILogger <RegisterModel> logger,
     IEmailController emailSender,
     IDbContextWrapper context)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = logger;
     _emailSender   = emailSender;
     this.context   = context;
 }
Пример #6
0
        private static void Autodiscover(string userName, string domain)
        {
            NetworkCredential credential = new NetworkCredential(userName, domain);

            HP.ScalableTest.TraceFactory.Logger.Debug("Autodiscovering...");
            HP.ScalableTest.TraceFactory.Logger.Debug("User:"******"Domain: " + domain);

            MailAddress address = ExchangeEmailController.GetLdapEmailAddress(credential);
            var         uri     = ExchangeEmailController.AutodiscoverExchangeUrl(address);

            HP.ScalableTest.TraceFactory.Logger.Debug("Autodiscovered URL:" + uri.ToString());

            _emailController = new ExchangeEmailController(credential, uri);
        }
Пример #7
0
        private void ConfigureEmailController()
        {
            SettingsDictionary exchangeServerSettings = null;

            using (AssetInventoryContext aiContext = DbConnect.AssetInventoryContext())
            {
                string          serverType = ServerType.Exchange.ToString();
                FrameworkServer server     = aiContext.FrameworkServers.FirstOrDefault(n => n.ServerTypes.Any(m => m.Name == serverType) && n.Active);
                exchangeServerSettings = new SettingsDictionary(server.ServerSettings.ToDictionary(n => n.Name, n => n.Value));
            }

            ExchangeConnectionSettings settings = new ExchangeConnectionSettings(exchangeServerSettings);

            if (settings.AutodiscoverEnabled)
            {
                TraceFactory.Logger.Debug("Configuring exchange service using Autodiscover.");
                _controller = new ExchangeEmailController(_credential, _emailAddress);
            }
            else
            {
                TraceFactory.Logger.Debug("Configuring exchange service using FrameworkServerSetting URL.");
                _controller = new ExchangeEmailController(_credential, settings.EwsUrl);
            }
        }
Пример #8
0
 public EmailResponseManager(IEmailController controller)
 {
     _emailController = controller;
 }
Пример #9
0
 /// <summary>
 /// Constructs the ExchangeInboxControl control.
 /// </summary>
 public ExchangeInboxControl(IEmailController controller)
 {
     InitializeComponent();
     _emailController = controller;
     inboxGridView.AutoGenerateColumns = false;
 }
Пример #10
0
 public ForgotPasswordModel(UserManager <IdentityUser> userManager, IEmailController emailSender)
 {
     _userManager = userManager;
     _emailSender = emailSender;
 }