mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Preserve filename of inline attachments
For ESPs that support both content-id and filename, don't drop the filename.
This commit is contained in:
@@ -118,10 +118,15 @@ class MandrillPayload(RequestsPayload):
|
||||
self.data["message"]["html"] = body
|
||||
|
||||
def add_attachment(self, attachment):
|
||||
key = "images" if attachment.inline else "attachments"
|
||||
self.data["message"].setdefault(key, []).append({
|
||||
if attachment.inline:
|
||||
field = "images"
|
||||
name = attachment.cid
|
||||
else:
|
||||
field = "attachments"
|
||||
name = attachment.name or ""
|
||||
self.data["message"].setdefault(field, []).append({
|
||||
"type": attachment.mimetype,
|
||||
"name": attachment.name or "",
|
||||
"name": name,
|
||||
"content": attachment.b64content
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user