From 15577ac4534d582361d6a5b58928f1329cdfd333 Mon Sep 17 00:00:00 2001 From: Jordan Sills Date: Wed, 16 Nov 2022 15:17:50 -0500 Subject: [PATCH 1/2] Add to GmailMessage.replyAll(). Removes EMAIL_ADDRESS from recipients. --- src/ezgmail/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ezgmail/__init__.py b/src/ezgmail/__init__.py index 125d2c2..cc88afd 100644 --- a/src/ezgmail/__init__.py +++ b/src/ezgmail/__init__.py @@ -420,9 +420,15 @@ def replyAll(self, body, attachments=None, cc=None, bcc=None, mimeSubtype="plain # NOTE: Since the ``sender`` argument is ignored by Gmail anyway, I'm not including in this method the # way it is included in ``send()``. - pass # TODO - I need to remove EMAIL_ADDRESS from the first argument here: - #send(self.sender + ', ' + self.recipient, self.subject, body, attachments=attachments, cc=cc, bcc=bcc, mimeSubtype=mimeSubtype, _threadId=self.threadId) + # Split recipients into list and remove element == EMAIL_ADDRESS + recipients = self.recipient.split(',') + recipients.remove(EMAIL_ADDRESS) + # recompile into a single string including the sender + recipients_str = self.sender + for i in recipients: + recipients_str = recipients_str + ', ' + i + send(recipients_str, self.subject, body, attachments=attachments, cc=cc, bcc=bcc, mimeSubtype=mimeSubtype, _threadId=self.threadId) def _parseContentTypeHeaderForEncoding(value): From a982a7e1d777446f9a81026dc6a0d820bcea9272 Mon Sep 17 00:00:00 2001 From: Jordan Sills Date: Wed, 16 Nov 2022 15:25:43 -0500 Subject: [PATCH 2/2] formatting on previous commit --- src/ezgmail/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ezgmail/__init__.py b/src/ezgmail/__init__.py index cc88afd..42fe5a5 100644 --- a/src/ezgmail/__init__.py +++ b/src/ezgmail/__init__.py @@ -421,6 +421,7 @@ def replyAll(self, body, attachments=None, cc=None, bcc=None, mimeSubtype="plain # NOTE: Since the ``sender`` argument is ignored by Gmail anyway, I'm not including in this method the # way it is included in ``send()``. # TODO - I need to remove EMAIL_ADDRESS from the first argument here: + # Split recipients into list and remove element == EMAIL_ADDRESS recipients = self.recipient.split(',') recipients.remove(EMAIL_ADDRESS)