public ActionResult StartEmailQueue() { try { InfEmail.StartQueue(); return(Content("The email queue was started successfully.")); } catch (Exception exception) { var baseException = exception.GetBaseException(); InfLogger.Log(baseException); return(Content(string.Format(CultureInfo.InvariantCulture, "An error occurred while attempting to start the email queue: {0}", baseException.Message))); } }
private static void InitEmail() { InfEmail.AutoStartQueue = ConfigurationManager.AppSettings["Inf:AutoStartEmailQueue"].TryConvertTo <bool>(false); InfEmail.QueueInterval = TimeSpan.FromSeconds(ConfigurationManager.AppSettings["Inf:EmailQueueIntervalSeconds"].TryConvertTo <int>(10)); InfEmail.MaxRetryAttempts = ConfigurationManager.AppSettings["Inf:MaxEmailRetryAttempts"].TryConvertTo <int>(5); if (InfEmail.AutoStartQueue) { try { InfEmail.StartQueue(); } catch (Exception exception) { InfLogger.Log(exception); } } }