Sendinblue: Support send_at

Add support for delayed sending via
Sendinblue's public beta "scheduledAt"
parameter.

Closes #280
This commit is contained in:
medmunds
2022-12-18 15:44:25 -08:00
committed by Mike Edmunds
parent a8cfb2e5eb
commit 287c2175f4
6 changed files with 58 additions and 9 deletions

View File

@@ -162,3 +162,10 @@ class SendinBluePayload(RequestsPayload):
def set_metadata(self, metadata):
# SendinBlue expects a single string payload
self.data['headers']["X-Mailin-custom"] = self.serialize_json(metadata)
def set_send_at(self, send_at):
try:
start_time_iso = send_at.isoformat(timespec="milliseconds")
except (AttributeError, TypeError):
start_time_iso = send_at # assume user already formatted
self.data['scheduledAt'] = start_time_iso