Mailjet: Prevent empty attachment filename

Mailjet requires all attachments/inlines have a non-empty Filename field.
Substitute `"attachment"` for missing filenames.

Fixes #407.
This commit is contained in:
Mike Edmunds
2024-12-10 12:01:17 -08:00
parent 45848440b3
commit c7f7428b7a
5 changed files with 31 additions and 7 deletions

View File

@@ -195,7 +195,8 @@ class MailjetPayload(RequestsPayload):
def add_attachment(self, attachment):
att = {
"ContentType": attachment.mimetype,
"Filename": attachment.name or "",
# Mailjet requires a non-empty Filename.
"Filename": attachment.name or "attachment",
"Base64Content": attachment.b64content,
}
if attachment.inline: