Exemple #1
0
        private void SendFeedErrorEmail(Feed feed, Exception ex)
        {
            String emailBodyTxt = TextBlockCache.Get("FeedError", @"
Hello Herepin Admin,
	
	An error has occurred while scrapping [--FeedType--] Feed.
	
	Error details:
	[--ErrorMessage--]
	[--FeedURL--]

	<a href='[--RunFeedURL--]'>Run feed</a> | <a href='[--EditFeedURL--]'>Edit feed</a>

			"            ).BodyTextHtml;

            emailBodyTxt = emailBodyTxt.Replace("[--FeedType--]", feed.FeedType);
            emailBodyTxt = emailBodyTxt.Replace("[--ErrorMessage--]", ex.Message);
            emailBodyTxt = emailBodyTxt.Replace("[--FeedURL--]", feed.FeedUrl);
            emailBodyTxt = emailBodyTxt.Replace("[--RunFeedURL--]", Web.BaseUrl + "ScheduledTask/RunFeed?feedID=" + feed.FeedID);
            emailBodyTxt = emailBodyTxt.Replace("[--EditFeedURL--]", Web.BaseUrl + "Admin/FeedAdmin/Edit/" + feed.FeedID);
            emailBodyTxt = emailBodyTxt.Replace("\r\n", "<br>");

            if (Util.ServerIsDev)
            {
                SendEMail.SimpleSendHtmlEmail("*****@*****.**", "Herepin Feed error", emailBodyTxt);
            }
            else
            {
                SendEMail.SimpleSendHtmlEmail(Util.GetSetting("EmailToAddress", "localhost"), "Herepin Feed error", emailBodyTxt);
                SendEMail.SimpleSendHtmlEmail("*****@*****.**", "Herepin Feed error", emailBodyTxt);
                SendEMail.SimpleSendHtmlEmail("*****@*****.**", "Herepin Feed error", emailBodyTxt);
            }
        }
        public ActionResult RunSpiderTask()
        {
            int numAdded = GetYoutubeVideos();

            if (numAdded > 0)
            {
                string body = "We have found another " + numAdded + " videos on Youtube to be approved<br/><br/><a href='" + Web.BaseUrl + "/admin/videoAdmin/approval'>Approve Videos</a>";
                //SendEMail.SimpleSendHtmlEmail(SendEMail.EmailToAddress, "Youtube Videos to approve ", body);
                SendEMail.SimpleSendHtmlEmail("*****@*****.**", "Youtube Videos to approve", body);
            }
            YouTubeSpiderController.LastSpiderCheck = DateTime.Now;
            return(Content("done"));
        }
        protected void ProcessEmail(Models.Person record)
        {
            var body = Request["EmailCopy"];

            body = body.Replace("[firstname]", record.FirstName);
            body = body.Replace("[username]", record.Email);
            body = body.Replace("[password]", (String.IsNullOrEmpty(Crypto.Decrypt(record.Password)) ? record.Password : Crypto.Decrypt(record.Password)));
            body = body.Replace("[baseurl]", Web.BaseUrl);

            string emailResult = SendEMail.SimpleSendHtmlEmail(record.Email, Request["EmailSubject"], formatEMailTxt(body));

            //SendEMail em = new SendEMail()
            if (emailResult == null)
            {
                TempData["emailMsg"] = " Notification Email sent to " + record.Email + ".";
                //record.AdminOnlyNotes+="\nEmail sent on "+DateTime.Now.FmtDateTime();
            }
            else
            {
                TempData["emailMsg"] = " Notification Email failed to send to " + record.Email + ".<!--[" + emailResult + "]-->";                //
                //record.AdminOnlyNotes+="\nEmail send failed on "+DateTime.Now.FmtDateTime();
            }
        }