public void PostToMailingList() { Mailer mailer = TypedConfiguration.Instance.Mailer; mailer.To = TypedConfiguration.Instance.MailTo; mailer.From = TypedConfiguration.Instance.MailFrom; mailer.SmtpHost = TypedConfiguration.Instance.MailServer; mailer.Subject = String.Format(TypedConfiguration.Instance.MailSubject, Revision, Author); mailer.TextBody = Info + "\r\n\r\n" + Changed + "\r\n\r\n" + SvnPostCommitHookApplication.InfoMessage(); mailer.Send(); }
public override void Format(Mailer mailer, CommitInformation commit) { // {0} = revision // {1} = author // {2} = timestamp // {3} = message string htmlHeadAndMeta = @" <!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN""> <html> <head> <title>Subversion Commit For Revision {0}</title> </head> <style> {4} </style> <body> <h1>Commit log for Revision {0}</h1> <dl> <dt>Author</dt> <dd>{1}</dd> <dt>Timestamp</dt> <dd>{2:yyyy-MM-dd hh:mm:ss}</dd> </dl> <p id=""message"">{3}</p>"; StringWriter writer = new StringWriter(); string safeMessage = HttpUtility.HtmlEncode(commit.LookInfo.Message).Replace(Environment.NewLine, "<br />"); writer.WriteLine(htmlHeadAndMeta, commit.Revision, commit.LookInfo.Author, commit.LookInfo.Timestamp, safeMessage, CssForHtml()); AppendHtmlLogMessage(writer, commit.LookInfo.Added, "Added"); AppendHtmlLogMessage(writer, commit.LookInfo.Modified, "Modified"); AppendHtmlLogMessage(writer, commit.LookInfo.Deleted, "Deleted"); AppendDiff(writer, commit.LookInfo.DiffLines); writer.WriteLine(@"<h5>{0}</h5>", SvnPostCommitHookApplication.InfoMessage()); writer.WriteLine(@"</body></html>"); mailer.HtmlBody = writer.ToString(); }
public override void Format(Mailer mailer, CommitInformation commit) { StringWriter writer = new StringWriter(); writer.WriteLine("Author: {0}", commit.LookInfo.Author); writer.WriteLine("Date: {0:yyyy-MM-dd hh:mm:ss}", commit.LookInfo.Timestamp); writer.WriteLine("Revision: {0}", commit.Revision); writer.WriteLine("Message:"); writer.WriteLine(commit.LookInfo.Message); writer.WriteLine(); writer.WriteLine(); AppendLogMessage(writer, commit.LookInfo.Added, "Added"); AppendLogMessage(writer, commit.LookInfo.Modified, "Modified"); AppendLogMessage(writer, commit.LookInfo.Deleted, "Deleted"); writer.WriteLine(); writer.WriteLine(); writer.WriteLine(SvnPostCommitHookApplication.InfoMessage()); mailer.TextBody = writer.ToString(); }