Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch email submission error by setting #73

Open
wants to merge 3 commits into
base: release/1.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions djangocms_moderation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@
COLLECTION_NAME_LENGTH_LIMIT = getattr(
settings, "CMS_MODERATION_COLLECTION_NAME_LENGTH_LIMIT", 24
)

EMAIL_NOTIFICATIONS_FAIL_SILENTLY = getattr(
settings, "MODERATION_EMAIL_NOTIFICATIONS_FAIL_SILENTLY", False
)
5 changes: 4 additions & 1 deletion djangocms_moderation/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from .conf import EMAIL_NOTIFICATIONS_FAIL_SILENTLY
from .utils import get_absolute_url


Expand Down Expand Up @@ -48,7 +49,9 @@ def _send_email(
from_email=settings.DEFAULT_FROM_EMAIL,
to=recipients,
)
return message.send()
return message.send(
fail_silently=EMAIL_NOTIFICATIONS_FAIL_SILENTLY
)


def notify_collection_author(collection, moderation_requests, action, by_user):
Expand Down
7 changes: 7 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Settings and configuration
==========================


Email notifications
------------------------
Configure email notifications to fail silently by setting: ``MODERATION_EMAIL_NOTIFICATIONS_FAIL_SILENTLY=True``
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Welcome to djangocms-moderation's documentation!
:maxdepth: 2
:caption: Contents:


configuration

Indices and tables
==================
Expand Down