Пример #1
0
        private void MainProg()
        {
            FoeServerLog.Add(_processName, FoeServerLog.LogType.Message, "Processor started.");

            // The process will keep running until shutdown is requested
            while (!_isShutdownRequested)
            {
                try
                {
                    // Download messages from mail server.
                    FoeServerMessage.DownloadMessages(FoeServerMessage.GetDefaultPopServer(), FoeServerRegistry.Get("ProcessorEmail"));
                }
                catch (Exception except)
                {
                    try
                    {
                        // log error message
                        FoeServerLog.Add(_processName, FoeServerLog.LogType.Error, "Error downloading message.\r\n" + except.ToString());
                    }
                    catch (Exception epicExcept)
                    {
                        // Wow, this is epic! Write to System Event Logs
                        EventLog.WriteEntry(_processName + " epic failure.\r\n" + except + "\r\n" + epicExcept, EventLogEntryType.Error);

                        // We should just terminate the process
                        _isShutdownRequested = true;
                    }
                }

                // Sleep for "_runInterval" seconds before checking email again.
                FoeServerScheduler.Sleep(WakeupCall, _runInterval);
            }

            FoeServerLog.Add(_processName, FoeServerLog.LogType.Message, "Processor stopped.");
        }
Пример #2
0
        static void Main(string[] args)
        {
            PrintTitle("Testing FoeServerMessage");

            // set up POP3 server
            PopServer server = FoeServerMessage.GetDefaultPopServer();

            Console.WriteLine("Downloading messages...");
            FoeServerMessage.DownloadMessages(server, "*****@*****.**");

            Console.WriteLine("Messages downloaded. Please check database for new records.");

            PrintFooter();
        }