void ReallyDoWork() { DaemonBasedDeliveryBoy boy; boy = new DaemonBasedDeliveryBoy(SMTPServer, SMTPUser, SMTPPassword, _sendAsAttachments); LinkMaker lm = new LinkMaker(RootURL); NewsletterManager manager = new NewsletterManager(TheFederation, lm , boy, _NewslettersFrom, _HeadInsert); StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); boy.Log = sw; LogEvent ev = TheFederation.LogEventFactory.CreateAndStartEvent(null, null, null, LogEvent.LogEventType.NewsletterGeneration); LogResult(sb); sw.WriteLine("Begin: " + DateTime.Now.ToString()); sw.WriteLine("Thread: " + Thread.CurrentThread.Name); try { manager.Notify(sw); } finally { ev.Record(); sw.WriteLine("End: " + DateTime.Now.ToString()); } // Append to the newsletters log file: string logFile = TheFederation.FederationNamespaceMapFilename; logFile = Path.GetDirectoryName(logFile) + Path.DirectorySeparatorChar + "Newsletter.log"; StreamWriter sw2 = File.AppendText(logFile); sw2.Write(sb.ToString()); sw2.Close(); }