Skip to content

Commit

Permalink
#727 Sender email se večkrat pošlje (#143)
Browse files Browse the repository at this point in the history
* addes todos

* send email to sender only once

* updated js import
  • Loading branch information
KlemenSpruk authored Oct 13, 2023
1 parent 30eab3e commit 852df6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def client_send(self, sender: str, recipient: Recipient, msg: dict, dlr_id: str)
.client("ses")
.send_email(
Destination={
"ToAddresses": [sender],
"ToAddresses": [recipient.email],
"CcAddresses": [],
"BccAddresses": [recipient.email],
"BccAddresses": [],
},
Message=msg,
Source=sender,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uuid
from typing import List

from django.conf import settings
Expand All @@ -24,6 +25,14 @@ def send(self, notification: DjangoProjectBaseNotification, extra_data, **kwargs
list(map(int, notification.recipients.split(","))) if notification.recipients else []
)
return len(recipients)
message = self.provider.get_message(notification)
sender = self.sender(notification)
self.provider.client_send(
self.sender(notification),
Recipient(identifier=str(uuid.uuid4()), phone_number="", email=sender),
message,
str(uuid.uuid4()),
)
return super().send(notification=notification, extra_data=extra_data)

def get_recipients(self, notification: DjangoProjectBaseNotification, unique_identifier=""):
Expand Down

0 comments on commit 852df6b

Please sign in to comment.