예제 #1
0
        public override void Run()
        {
            EmailHandlerService.Start();

            while (true)
            {
                var msgs = EmailsManager.GetAllNewMessages();

                msgs.ForEach(info => {
                    EmailHandlerService.HandleEmail(info);
                    Thread.Sleep(3000); // We give time to the previous instance to start properly. I noticed some problems during tests
                });

                Thread.Sleep(TimeSpan.FromMinutes(15));
            }
        }
예제 #2
0
 /// <summary>
 /// Constructs a new instance of this controller
 /// </summary>
 /// <param name="emailHandlerService">The service used to interact with email handlers and templates</param>
 /// <param name="serviceProvider">An instance of a service provider</param>
 public EmailMessageController(EmailHandlerService emailHandlerService, IServiceProvider serviceProvider, IUserSession userSession) : base(serviceProvider, userSession)
 {
     this.EmailHandlerService = emailHandlerService;
 }
 public EmailTemplateController(EmailTemplateRepository emailTemplateRepository, EmailHandlerService emailHandlerService, IServiceProvider serviceProvider, IUserSession userSession) : base(serviceProvider, userSession)
 {
     this.EmailHandlerService     = emailHandlerService;
     this.EmailTemplateRepository = emailTemplateRepository;
 }