public static object StandardEmail(object parms) { try { ParamPack px = parms as ParamPack; // hmm.. badness if (px == null || px.m_toAddress == null) { string message = String.Format("Error: in Accounting.Emailer. paramater pack."); throw new ApplicationException(message); } // Adam: bacause we may send this to both the recipient and the email archive server // we allow distribution lists if (SmtpDirect.CheckEmailAddy(px.m_toAddress, true) == false) { string message = String.Format("Email: Bad address detected '{0}'.", px.m_toAddress); throw new ApplicationException(message); } SmtpDirect mail = new SmtpDirect(); mail.SendEmail(px.m_toAddress, px.m_subject, px.m_body, px.m_ccRegistration); return(true); } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception: " + e.Message); Console.WriteLine(e.StackTrace); } return(false); }
public void SmokeTest_UnknownFails() { var connection = ServerConnection.Create(_serverPath, true); var reportWrapper = ReportWrapper.Create(connection, _reportPath); var parameters = ParamPack.Create("pack1"); var result = reportWrapper.Render(ReportRenderFormat.Unknown, parameters.Pack()); Assert.That(result.Failure, Is.True); }
public static object DistributionList(object parms) { try { ParamPack px = parms as ParamPack; // hmm.. badness if (px == null || px.m_distributionList == null) { try { throw new ApplicationException("Error: in Accounting.Emailer. paramater pack."); } catch (Exception ex) { Server.EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } return(false); } // for now, just print them for (int ix = 0; ix < px.m_distributionList.Count; ix++) { // pause for 1 second between sends // if we are sending to N thousand players, we don't want to // eat all our bandwidth System.Threading.Thread.Sleep(1000); string addy = px.m_distributionList[ix] as string; if (addy == null) { continue; // may not be null } // Adam: bacause recipient is specified, we do not allow distribution lists if (SmtpDirect.CheckEmailAddy(addy, false) == false) { Console.WriteLine("Email: Bad address detected '{0}'.", addy); continue; } Console.WriteLine("Email: Sending {0} of {1}.", ix + 1, px.m_distributionList.Count); // send it baby! new SmtpDirect().SendEmail(addy, px.m_subject, px.m_body, false); } Console.WriteLine("Done."); return(px.m_distributionList.Count); } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine("Exception: " + e.Message); Console.WriteLine(e.StackTrace); } return(0); }
public bool SendEmail(ArrayList toAddresses, string subject, string body, bool ccRegistration) { ParamPack parms = new ParamPack(toAddresses, subject, body, ccRegistration); // okay, now hand the list of users off to our mailer daemon //ThreadJob job = new ThreadJob(new JobWorker(ThreadWorkers.DistributionList), parms, null); //job.Start(JobPriority.Critical); // non threaded version //ThreadWorkers.DistributionList(parms); // simple threads version Thread t = new Thread(new ThreadStart(parms.post)); t.Priority = ThreadPriority.Lowest; t.IsBackground = true; t.Start(); return(true); }
public void SmokeTest_AllFormats(ReportRenderFormat format) { var connection = ServerConnection.Create(_serverPath, true); var reportWrapper = ReportWrapper.Create(connection, _reportPath); var parameters = ParamPack.Create("pack1"); var result = reportWrapper.Render(format, parameters.Pack()); if (result.Failure) { Debug.WriteLine(result.Error); } Assert.That(result.Success, Is.True); Assert.That(result.Value.Stream, Is.Not.Null); Assert.That(result.Value.Stream.Length, Is.GreaterThan(0)); }
public bool SendEmail(ArrayList toAddresses, string subject, string body, bool ccRegistration) { ParamPack parms = new ParamPack(toAddresses, subject, body, ccRegistration); // okay, now hand the list of users off to our mailer daemon //ThreadJob job = new ThreadJob(new JobWorker(ThreadWorkers.DistributionList), parms, null); //job.Start(JobPriority.Critical); // non threaded version //ThreadWorkers.DistributionList(parms); // simple threads version Thread t = new Thread(new ThreadStart(parms.post)); t.Priority = ThreadPriority.Lowest; t.IsBackground = true; t.Start(); return true; }
private Report(Report other) { Location = other.Location; Parameters = other.Parameters; TestCase = other.TestCase; }