mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Invert unsupported-features setting
Change from UNSUPPORTED_FEATURE_ERRORS (default True) to IGNORE_UNSUPPORTED_FEATURES (default False). Parallels IGNORE_RECIPIENT_STATUS.
This commit is contained in:
@@ -17,7 +17,7 @@ class AnymailBaseBackend(BaseEmailBackend):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AnymailBaseBackend, self).__init__(*args, **kwargs)
|
||||
|
||||
self.unsupported_feature_errors = get_anymail_setting("UNSUPPORTED_FEATURE_ERRORS", True)
|
||||
self.ignore_unsupported_features = get_anymail_setting("IGNORE_UNSUPPORTED_FEATURES", False)
|
||||
self.ignore_recipient_status = get_anymail_setting("IGNORE_RECIPIENT_STATUS", False)
|
||||
|
||||
# Merge SEND_DEFAULTS and <esp_name>_SEND_DEFAULTS settings
|
||||
@@ -227,7 +227,7 @@ class BasePayload(object):
|
||||
setter(value)
|
||||
|
||||
def unsupported_feature(self, feature):
|
||||
if self.backend.unsupported_feature_errors:
|
||||
if not self.backend.ignore_unsupported_features:
|
||||
raise AnymailUnsupportedFeature("%s does not support %s" % (self.esp_name, feature),
|
||||
email_message=self.message, payload=self, backend=self.backend)
|
||||
|
||||
|
||||
@@ -159,9 +159,9 @@ A `dict` of default options to apply to all messages sent through Anymail.
|
||||
See :ref:`send-defaults`.
|
||||
|
||||
|
||||
.. rubric:: UNSUPPORTED_FEATURE_ERRORS
|
||||
.. rubric:: IGNORE_UNSUPPORTED_FEATURES
|
||||
|
||||
Whether Anymail should raise :exc:`~anymail.exceptions.AnymailUnsupportedFeature`
|
||||
errors for email with features that can't be accurately communicated to the ESP.
|
||||
Set to `False` to ignore these problems and send the email anyway. See
|
||||
:ref:`unsupported-features`. (Default `True`.)
|
||||
Set to `True` to ignore these problems and send the email anyway. See
|
||||
:ref:`unsupported-features`. (Default `False`.)
|
||||
|
||||
@@ -116,17 +116,17 @@ For example, very few ESPs support alternative message parts added with
|
||||
If you try to send a message with other alternative parts, Anymail will
|
||||
raise :exc:`~exceptions.AnymailUnsupportedFeature`.
|
||||
|
||||
.. setting:: ANYMAIL_UNSUPPORTED_FEATURE_ERRORS
|
||||
.. setting:: ANYMAIL_IGNORE_UNSUPPORTED_FEATURES
|
||||
|
||||
If you'd like to silently ignore :exc:`~exceptions.AnymailUnsupportedFeature`
|
||||
errors and send the messages anyway, set :setting:`!ANYMAIL_UNSUPPORTED_FEATURE_ERRORS`
|
||||
to `False` in your settings.py:
|
||||
errors and send the messages anyway, set :setting:`!ANYMAIL_IGNORE_UNSUPPORTED_FEATURES`
|
||||
to `True` in your settings.py:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
ANYMAIL = {
|
||||
...
|
||||
"UNSUPPORTED_FEATURE_ERRORS": False,
|
||||
"IGNORE_UNSUPPORTED_FEATURES": True,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@ Exceptions
|
||||
.. exception:: AnymailUnsupportedFeature
|
||||
|
||||
If the email tries to use features that aren't supported by the ESP, the send
|
||||
call will raise an :exc:`!AnymailUnsupportedFeature` error (a subclass
|
||||
of :exc:`ValueError`), and the message won't be sent.
|
||||
call will raise an :exc:`!AnymailUnsupportedFeature` error, and the message
|
||||
won't be sent. See :ref:`unsupported-features`.
|
||||
|
||||
You can disable this exception (ignoring the unsupported features and
|
||||
sending the message anyway, without them) by setting
|
||||
:setting:`ANYMAIL_UNSUPPORTED_FEATURE_ERRORS` to ``False``.
|
||||
:setting:`ANYMAIL_IGNORE_UNSUPPORTED_FEATURES` to `True`.
|
||||
|
||||
|
||||
.. exception:: AnymailRecipientsRefused
|
||||
|
||||
Reference in New Issue
Block a user