Add bcc option for event emails

This commit is contained in:
Raphael Michel
2018-06-22 13:28:54 +02:00
parent 28f6f09e8f
commit 5e7027647a
4 changed files with 14 additions and 0 deletions

View File

@@ -106,9 +106,12 @@ def mail(email: str, subject: str, template: Union[str, LazyI18nString],
'color': '#8E44B3'
}
bcc = []
if event:
htmlctx['event'] = event
htmlctx['color'] = event.settings.primary_color
if event.settings.mail_bcc:
bcc.append(event.settings.mail_bcc)
if event.settings.mail_from == settings.DEFAULT_FROM_EMAIL and event.settings.contact_mail and not headers.get('Reply-To'):
headers['Reply-To'] = event.settings.contact_mail
@@ -153,6 +156,7 @@ def mail(email: str, subject: str, template: Union[str, LazyI18nString],
send_task = mail_send_task.si(
to=[email],
bcc=bcc,
subject=subject,
body=body_plain,
html=body_html,

View File

@@ -225,6 +225,10 @@ DEFAULTS = {
'default': None,
'type': str
},
'mail_bcc': {
'default': None,
'type': str
},
'mail_from': {
'default': settings.MAIL_FROM,
'type': str

View File

@@ -663,6 +663,11 @@ class MailSettingsForm(SettingsForm):
label=_("Sender address"),
help_text=_("Sender address for outgoing emails")
)
mail_bcc = forms.EmailField(
label=_("Bcc address"),
help_text=_("All emails will be sent to this address as a Bcc copy"),
required=False
)
mail_text_signature = I18nFormField(
label=_("Signature"),

View File

@@ -11,6 +11,7 @@
{% bootstrap_field form.mail_prefix layout="control" %}
{% bootstrap_field form.mail_from layout="control" %}
{% bootstrap_field form.mail_text_signature layout="control" %}
{% bootstrap_field form.mail_bcc layout="control" %}
</fieldset>
<fieldset>
<legend>{% trans "E-mail content" %}</legend>