Comments (5)
Would you want some help to refactor?
Yes, please! If you want to open a PR with any or all of the above, that would be much appreciated.
from django-anymail.
Thanks for investigating, and for including a full raw email demonstrating the problem.
My initial reaction was, Apple Mail is doing something weird, so yeah, whatever workaround makes sense. But the more I investigated, Apple Mail's use of multipart/mixed to interleave text/plain and inline image parts is a valid approach. The inline images don't need content-ids, because they're not being referenced elsewhere, and multipart/mixed is defined to present its parts in sequential order. (See RFC 2046 section 5.1.3โand W3C's older version that clarifies multipart/mixed children are "intended to be displayed serially." Also RFC 2183 sections 2.1-2.2 which specify content-disposition.)
Arguably, Gmail is doing the wrong thing by presenting the inline images at the end of the message as attachments.
I think the bug here is that Anymail's inline_attachments
doesn't include these inline images that don't have content-ids, even though they are inline content. (And in fact, it can't, because inline_attachments
is actually a dict mapping content-id to MIMEPart.)
The underlying problem is that Anymail's inline_attachments
dict doesn't parallel its attachments
list, leading to understandable confusion. (Something similar came up in #229.) Also "inline attachment" isn't really a thingโa MIMEPart is either inline or an attachment (or neither), never both.
Proposal:
- Rename Anymail's
inline_attachments
tocontent_id_map
(orcid_map
?), reflecting what it actually implements. (Keepinline_attachments
as a deprecated alias forcontent_id_map
, issuing a warning on use.) - Rename Anymail's
is_inline_attachment()
tois_inline()
. (And keep the original as a deprecated alias.) - Add a new
inlines
list property that returns a sequence of parts that are inline (paralleling the behavior ofattachments
). - Derive AnymailInboundMessage from Python's email.message.EmailMessage, rather than email.message.Message. (Current implementation is a holdover from Python 2.7 support.) Since EmailMessage already implements
is_attachment()
(via MIMEPart), get rid of the AnymailInboundMessage version.
from django-anymail.
Thanks for the follow up @medmunds.
I was not sure what was the intended behaviour between displaying images inline or consider it as raw attachments, so thanks for clarifying this. ๐
Your proposal works for me! Would you want some help to refactor?
from django-anymail.
@medmunds Here is a start #330 ;)
from django-anymail.
Resolved by #330.
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
- parse_address_list: Inability to Parse Email Addresses with Special Characters in Display Name Without Double-Quote Encapsulation HOT 1
- 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 8
- 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 2
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.