mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Postmark: Fix Postmark error on empty subject/body with template_id.
Postmark issues an error if Django's default empty strings are used with template sends. Include template send in Postmark integration tests. (Requires real Postmark API token -- templates aren't testable with Postmark's sandbox token.) Fixes #121
This commit is contained in:
@@ -198,6 +198,11 @@ class PostmarkPayload(RequestsPayload):
|
||||
|
||||
def set_template_id(self, template_id):
|
||||
self.data["TemplateId"] = template_id
|
||||
# Subject, TextBody, and HtmlBody aren't allowed with TemplateId;
|
||||
# delete Django default subject and body empty strings:
|
||||
for field in ("Subject", "TextBody", "HtmlBody"):
|
||||
if field in self.data and not self.data[field]:
|
||||
del self.data[field]
|
||||
|
||||
# merge_data: Postmark doesn't support per-recipient substitutions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user