mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Mailgun: raise unsupported feature error on attachment without filename.
Mailgun's API silently drops attachments without filenames (and inline attachments without Content-IDs). Raise an AnymailUnsupportedFeature error on attempts to send these attachments. Fixes #128
This commit is contained in:
@@ -188,9 +188,13 @@ class MailgunPayload(RequestsPayload):
|
||||
if attachment.inline:
|
||||
field = "inline"
|
||||
name = attachment.cid
|
||||
if not name:
|
||||
self.unsupported_feature("inline attachments without Content-ID")
|
||||
else:
|
||||
field = "attachment"
|
||||
name = attachment.name
|
||||
if not name:
|
||||
self.unsupported_feature("attachments without filenames")
|
||||
self.files.append(
|
||||
(field, (name, attachment.content, attachment.mimetype))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user