Permalink
Browse files

Register FORMS_DISABLE_SEND_FROM_EMAIL_FIELD in mezzanine.conf.

  • Loading branch information...
1 parent f9a5974 commit 13b7194987e4ae4741ba50f0408e4dfb91b15b72 @stephenmcd stephenmcd committed Jan 5, 2012
Showing with 12 additions and 3 deletions.
  1. +9 −0 mezzanine/conf/defaults.py
  2. +3 −3 mezzanine/forms/page_processors.py
@@ -205,6 +205,15 @@
)
register_setting(
+ name="FORMS_DISABLE_SEND_FROM_EMAIL_FIELD",
+ description=_("If ``True``, emails sent to extra recipients for form "
+ "submissions won't be sent from an address taken from one of the "
+ "form's email fields."),
+ editable=False,
+ default=False,
+)
+
+register_setting(
name="FORMS_FIELD_MAX_LENGTH",
description=_("Max length allowed for field values in the forms app."),
editable=False,
@@ -35,12 +35,12 @@ def form_processor(request, page):
if email_to and page.form.send_email:
msg = EmailMessage(subject, body, email_from, [email_to])
msg.send()
- if not getattr(settings.FORMS_DISABLE_SEND_FROM_EMAIL_FIELD, False):
+ if not settings.FORMS_DISABLE_SEND_FROM_EMAIL_FIELD:
# Send from the email entered,
# unless FORMS_DISABLE_SEND_FROM_EMAIL_FIELD is True.
email_from = email_to or email_from
- email_copies = [e.strip() for e in page.form.email_copies.split(",")
- if e.strip()]
+ email_copies = page.form.email_copies.split(",")
+ email_copies = [e.strip() for e in email_copies if e.strip()]
if email_copies:
msg = EmailMessage(subject, body, email_from, email_copies)
for f in form.files.values():

0 comments on commit 13b7194

Please sign in to comment.