public static void SendAdNotification(AdsDataComponent.AdsRow ad)
{
SiteSettings s = SiteSettings.GetSharedSettings();
StringBuilder messageBody = new StringBuilder();
messageBody.AppendFormat("A new Ad has just been to the Classifieds site '{0}':", s.SiteName);
messageBody.AppendLine();
messageBody.AppendLine();
messageBody.Append("Title: ");
messageBody.AppendLine(ad.Title);
messageBody.Append("Category: ");
messageBody.AppendLine(ad.CategoryName);
messageBody.AppendLine();
messageBody.AppendLine("For Details and Activation: ");
messageBody.Append(ClassifiedsHttpApplication.SiteUrl);
messageBody.AppendFormat("EditAd.aspx?id={0}", ad.Id);
messageBody.AppendLine();
if ((AdStatus)ad.AdStatus != AdStatus.Activated)
{
messageBody.AppendLine("Status: The Ad is not yet active.");
}
else
{
messageBody.AppendLine("Status: The Ad was activated automatically.");
}
try
{
MailMessage m = new MailMessage(s.SiteEmailFromField, GetAdminRecipients());
m.Subject = String.Format("New Ad posted: {0}", ad.Title);
m.Body = messageBody.ToString();
SmtpClient client = new SmtpClient();
client.Send(m);
}
catch { }
}