public static void MarkHam(PostComments.Comment comment) { var api = new Akismet(AkismetKey, BlogUrl, comment.UserAgent); if (!api.VerifyKey()) throw new Exception("Akismet API key invalid."); var akismetComment = new AkismetComment { Blog = BlogUrl, UserIp = comment.UserHostAddress, UserAgent = comment.UserAgent, CommentContent = comment.Body, CommentType = "comment", CommentAuthor = comment.Author, CommentAuthorEmail = comment.Email, CommentAuthorUrl = comment.Url, }; #if !DEBUG api.SubmitHam(akismetComment); #endif }
public void MarkHam(PostComments.Comment comment) { //Create a new instance of the Akismet API and verify your key is valid. string blog = ConfigurationManager.AppSettings["MainUrl"]; var api = new Akismet(akismetKey, blog, comment.UserAgent); if (!api.VerifyKey()) throw new Exception("Akismet API key invalid."); var akismetComment = new AkismetComment { Blog = blog, UserIp = comment.UserHostAddress, UserAgent = comment.UserAgent, CommentContent = comment.Body, CommentType = "comment", CommentAuthor = comment.Author, CommentAuthorEmail = comment.Email, CommentAuthorUrl = comment.Url, }; #if !DEBUG api.SubmitHam(akismetComment); #endif }
public static void MarkAsHam(int memberId, string body, string commentType) { var akismetApi = new Akismet(AkismetApiKey, "http://our.umbraco.org", "Test/1.0"); if (akismetApi.VerifyKey() == false) throw new Exception("Akismet API key could not be verified"); var member = new Member(memberId); var comment = new AkismetComment { Blog = "http://our.umbraco.org", UserIp = member.getProperty("ip").Value.ToString(), CommentAuthor = member.Text, CommentAuthorEmail = member.Email, CommentType = commentType, CommentContent = body }; akismetApi.SubmitHam(comment); }