Exemplo n.º 1
0
        private void NotifyReplyTarget(Comment comment)
        {
            Comment     replyTarget = session.Get <Comment>(comment.Target.Value);
            PostExcerpt post        = session.Get <PostExcerpt>(comment.PostName);

            if (replyTarget != null)
            {
                MailMessage message = new MailMessage(
                    new MailAddress(email, siteName),
                    new MailAddress(replyTarget.Author.Email, replyTarget.Author.Name)
                    );
                message.Subject = String.Format("你在 {0} 的评论收到了回复", post.Title);
                message.Body    = String.Format(
                    template,
                    replyTarget.Author.Name, post.Title,
                    transformer.Transform(replyTarget.Content),
                    comment.Author.Name,
                    transformer.Transform(comment.Content),
                    baseUrl, post.Name, comment.Id
                    );
                message.IsBodyHtml      = true;
                message.SubjectEncoding = Encoding.UTF8;
                message.BodyEncoding    = Encoding.UTF8;
                using (SmtpClient client = new SmtpClient()) {
                    client.Send(message);
                }
            }
        }
Exemplo n.º 2
0
 private PostExcerpt RenderExcerpt(PostExcerpt excerpt)
 {
     excerpt         = excerpt.Clone();
     excerpt.Excerpt = Transformer.Transform(excerpt.Excerpt);
     return(excerpt);
 }