private static void SendSummaryMail(int numPendingNew, int numPendingTotal)
{
SiteSettings s = SiteSettings.GetSharedSettings();
// only send mail when there are pending ads to report:
// if reporting each hour, only send mail when there were *new* ads within the hour
// if reporting each day, send mail if there are *any* unactivated ads
if (numPendingNew > 0 || (s.AdminNotification == AdminNotificationSetting.Daily && numPendingTotal > 0))
{
StringBuilder messageBody = new StringBuilder();
StringBuilder recipients = new StringBuilder();
messageBody.AppendLine("There are new Ads waiting for activation:");
messageBody.AppendLine();
messageBody.AppendFormat("... {0} new Ads since the last notification was sent", numPendingNew);
messageBody.AppendLine();
messageBody.AppendFormat("... {0} total Ads waiting for activation", numPendingTotal);
messageBody.AppendLine();
messageBody.AppendLine();
messageBody.AppendLine("You can access all pending activations at:");
messageBody.Append(ClassifiedsHttpApplication.SiteUrl);
messageBody.Append("Admin/Activations.aspx");
try
{
MailMessage m = new MailMessage(s.SiteEmailFromField, GetAdminRecipients());
m.Subject = "Ad Notification Summary";
m.Body = messageBody.ToString();
SmtpClient client = new SmtpClient();
client.Send(m);
}
catch { }
}
}