Skip to content

Commit 3fdb3de

Browse files
committed
Added hooks for proper CC/BCC handling
1 parent 523852f commit 3fdb3de

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

sendgrid/header.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ def add_to(self, to):
1616
else:
1717
self.data['to'] += to
1818

19+
def add_cc(self, cc):
20+
if 'cc' not in self.data:
21+
self.data['cc'] = []
22+
if type(cc) is str:
23+
self.data['cc'] += [cc]
24+
else:
25+
self.data['cc'] += cc
26+
27+
def add_bcc(self, bcc):
28+
if 'bcc' not in self.data:
29+
self.data['bcc'] = []
30+
if type(bcc) is str:
31+
self.data['bcc'] += [bcc]
32+
else:
33+
self.data['bcc'] += bcc
34+
1935
def set_replyto(self, replyto):
2036
self.data['reply_to'] = replyto
2137

sendgrid/message.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ def add_cc(self, recipients):
120120
else:
121121
self.cc += recipients
122122

123+
self.header.add_cc(recipients)
124+
123125
return self
124126

125127
def add_bcc(self, recipients):
@@ -138,6 +140,8 @@ def add_bcc(self, recipients):
138140
else:
139141
self.bcc += recipients
140142

143+
self.header.add_bcc(recipients)
144+
141145
return self
142146

143147
def add_attachment(self, name, file, cid=None):

0 commit comments

Comments
 (0)