示例#1
0
        protected virtual void SendMail(ControllerContext controllerContext, Site site, ContactSiteModel ContactSiteModel, HttpFileCollectionBase files) {

            var from = ContactSiteModel.From;
            var subject = ContactSiteModel.Subject;
            var body = string.Format(ContactSiteModel.EmailBody ,ContactSiteModel.From, ContactSiteModel.Subject, ContactSiteModel.Body);

            site.SendMailToSiteManager(from, subject, body, true , files);
        }
示例#2
0
 public void SendMail(Site site, string from, string subject, string body, bool? isBodyHtml, HttpFileCollectionBase files)
 {
     site.SendMailToSiteManager(from, subject, body, isBodyHtml == null ? false : isBodyHtml.Value, files);
 }
示例#3
0
        private void SendLog(PublishingLog item)
        {
            if (!string.IsNullOrEmpty(item.SiteName))
            {
                var site = new Site(item.SiteName).AsActual();
                //have set smtp
                if (site != null && site.Smtp != null && !string.IsNullOrEmpty(site.Smtp.Host) && !string.IsNullOrEmpty(site.Smtp.From)
                    && site.Smtp.To != null && site.Smtp.To.Length > 0)
                {
                    var logMessage = @"
Log type    : {0},
Action      : {1},
Item type   : {2},
Title       : {3},
Object UUID : {4}
Remote sites: {5},
Folder mapping:{6},
User        : {7},
Status      : {8}
Processed time:{9},
Message     : {10},
Stack trace : {11}
";
                    logMessage = string.Format(logMessage, item.QueueType,
                        item.PublishingAction,
                        item.PublishingObject,
                        item.ObjectTitle,
                        item.ObjectUUID,
                        string.IsNullOrEmpty(item.RemoteEndpoint) ? "-" : item.RemoteEndpoint,
                        string.IsNullOrEmpty(item.TextFolderMapping) ? "-" : item.TextFolderMapping,
                        string.IsNullOrEmpty(item.UserId) ? "-" : item.UserId,
                        item.Status,
                        item.UtcProcessedTime.Value.ToLocalTime(),
                        string.IsNullOrEmpty(item.Message) ? "-" : item.Message,
                        string.IsNullOrEmpty(item.StackTrace) ? "-" : item.StackTrace);


                    site.SendMailToSiteManager(site.Smtp.From, "Publishing log", logMessage, false);

                }
            }
        }