diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a3c9017771..c01081a9e1 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,7 @@ Changelog ~~~~~~~~~~~~~~~~ * The Wagtail version number can now be obtained as a tuple using `from wagtail import VERSION` (Tim Heap) + * ``send_mail`` logic has been moved from ``AbstractEmailForm.process_form_submission`` into ``AbstractEmailForm.send_mail``. Now it's easier to override this logic (Tim Leguijt) * Fix: Migrations for wagtailcore and project template are now reversible (Benjamin Bach) * Fix: The default image format label text ('Full width', 'Left-aligned', 'Right-aligned') is now localised (Mikalai Radchuk) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 41bf71d5bf..722a2836c9 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -161,6 +161,7 @@ Contributors * Fábio Macêdo Mendes * Eraldo Energy * Jesse Legg +* Tim Leguijt Translators =========== diff --git a/docs/releases/1.7.rst b/docs/releases/1.7.rst index 612ffe477c..8cfe9f0560 100644 --- a/docs/releases/1.7.rst +++ b/docs/releases/1.7.rst @@ -15,6 +15,7 @@ Minor features ~~~~~~~~~~~~~~ * The Wagtail version number can now be obtained as a tuple using ``from wagtail import VERSION`` (Tim Heap) +* ``send_mail`` logic has been moved from ``AbstractEmailForm.process_form_submission`` into ``AbstractEmailForm.send_mail``. Now it's easier to override this logic (Tim Leguijt) Bug fixes diff --git a/wagtail/wagtailforms/models.py b/wagtail/wagtailforms/models.py index ff3ed13a69..25887b6cc7 100644 --- a/wagtail/wagtailforms/models.py +++ b/wagtail/wagtailforms/models.py @@ -218,10 +218,10 @@ class AbstractEmailForm(AbstractForm): def process_form_submission(self, form): submission = super(AbstractEmailForm, self).process_form_submission(form) if self.to_address: - self.send_form_mail(form) + self.send_mail(form) return submission - def send_form_mail(self, form): + def send_mail(self, form): addresses = [x.strip() for x in self.to_address.split(',')] content = '\n'.join([x[1].label + ': ' + text_type(form.data.get(x[0])) for x in form.fields.items()]) send_mail(self.subject, content, addresses, self.from_address,)