Comments (1)
Could I confirm that this report is about receiving email with Anymail's inbound webhooks? (Not about sending email from your app.)
It sounds like you are receiving inbound email with a malformed1 From or To address header field, and getting an AnymailInvalidAddress
error when trying to access the inbound message from_email
or to
.
I appreciate that you included a proposed workaround, but parse_address_list
is shared with Anymail's sending code, so we can't try to fix things there. (Anymail avoids working around bugs in the caller's code, because that would cause problems for anyone who wants to switch from Anymail to some other Django email backend.)
Unfortunately, I don't think there is a reliable workaround, even if we could find a way to isolate it to Anymail's inbound handling. Parsing email address headers with regular expressions is notoriously difficult. (For example, how would your proposed code handle a To header with multiple comma-separated email addresses? Or a display name with non-ASCII characters, which is encoded using RFC-2047 and breaks if you try to enclose it in quotes? Or backslash escapes like \"
which are permitted inside quoted strings? Etc.)
The malformed header is not the responsibility of the end user that sent the mail, but it is a bug in whatever app or web service they used to send it. The standard for quoting display names in email addresses is 40+ years old,2 and nearly all popular email apps do it correctly—at least for the basic example you reported. (But many spam senders don't. Does the problem email seem like spam?)
If this email was sent from a commonly used email app or web service, please provide more details so we can take a closer look (and/or report the problem to that app). Otherwise, I'm inclined to close this as "not planned."
Footnotes
-
RFC-5322 requires double quotes around an address display-name with special characters: see section 3.4 "Address Specifications," and sections 3.2.3–3.2.5 for the rules that mandate double quotes around a phrase that contains any characters other than atext. ↩
-
RFC-5322's predecessor RFC-822 included the requirements for double quotes, back in 1982. ↩
from django-anymail.
Related Issues (20)
- Add support to Resend.com HOT 5
- Handlebars variables not substitued in mandrill templates HOT 1
- mailgun api key HOT 2
- Merging/Combine ESP Options get lost/overwritten HOT 2
- Mailjet Open tracking? HOT 4
- Inaccuracy in documentation about Brevo's behaviour HOT 2
- Feature request: Mailtrap HOT 4
- Resend: confusing ReadTimeout error for incorrect API key
- Add support to Unisender Go HOT 2
- Support Brevo batch sending with merge_data HOT 2
- Add batch sending support for Resend HOT 1
- Mailgun webhooks: AttributeError 'NoneType' object has no attribute 'get' HOT 1
- boto3 sesv2 client does not have method 'send_email'. Check AmazonSESV2SendEmailPayload HOT 4
- Bad UTF-8 "To" header encoding? HOT 6
- Tests fail with error "AppRegistryNotReady: Apps aren't loaded yet"
- Tests fail with error "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet" HOT 4
- New feature: per-recipient merge_headers
- Amazon SES: support extra_headers, metadata, tags for template sends
- Brevo `trace_clicks` and `trace_opens` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-anymail.