Inheritance: ContactFormContext
        public void ContactFormEntryCreating(ContactFormCreatingContext context)
        {
            var text = context.ContactFormEntry.As<BodyPart>().Text;
            var spamTerms = new[] { "viagra", "opportunity", "win!" };

            if (!spamTerms.Any(text.Contains))
                return;

            context.Cancel = true;
            _notifier.Warning(T("Your message is rated as spam and therefore not delivered."));
        }
        public ContentItem StoreEntry(ContactFormEntry entry)
        {
            foreach (var filter in _filters) {
                filter.Process(entry);
            }

            var contentItem = NewEntry(entry);

            var entryCreatingContext = new ContactFormCreatingContext {
                ContactFormEntry = contentItem
            };

            _contactFormEventHandler.ContactFormEntryCreating(entryCreatingContext);

            if (entryCreatingContext.Cancel)
                return null;

            _services.ContentManager.Create(contentItem);

            var entryCreatedContext = new ContactFormCreatedContext {
                ContactFormEntry = contentItem
            };

            _contactFormEventHandler.ContactFormEntryCreated(entryCreatedContext);

            _services.Notifier.Information(T("Your message has been received. Thanks for contacting us!"));
            return contentItem;
        }
 public void ContactFormEntryCreating(ContactFormCreatingContext context)
 {
 }