Replies: 1 comment 3 replies
-
What version of Anymail are you using? Anymail v8.5 (released a few months ago) stopped including the sender and recipient email addresses in every Anymail error message. But even in v8.5, Anymail error messages still include any error response from the ESP. Depending on the ESP and the particular error, this can sometimes contain the recipient email address. If that's a problem, you could probably redact things that look like email addresses in your celery task. Something like (untested): try:
message.send()
except AnymailError as error:
# Raise a redacted version of error, replacing any `*@*` in its text
redacted = re.sub(r"\S+@\S+", "[EMAIL REDACTED]", str(error))
raise error.__class__(redacted).with_traceback(error.__traceback__) from None Another option is to redact error messages where they enter your log files—globally—rather than at each point where errors might be generated. Packages like Sentry's Raven data collector use that sort of approach. For example, you could implement a custom logging filter to apply the redaction above to every LogRecord.msg: see Django's logging docs and Python's |
Beta Was this translation helpful? Give feedback.
-
This is a question not an error report.
We want to de-identify information about the recipient on logged errors.
We are using celery with retries. After 10 retries (configured) it raises
AnymailRequestsAPIError
and in the log message it escapes the recipient email address.Is there a way to avoid having the email added to the log message?
Thanks in advance!!
Awesome package!!
Andre
Beta Was this translation helpful? Give feedback.
All reactions