Skip to content
Browse files

support for cc and bcc in web.sendmail

  • Loading branch information...
1 parent 175c8b6 commit 247d5019b1f7492dfee254ae9e744e0e739c1ec5 @anandology anandology committed Dec 15, 2007
Showing with 13 additions and 7 deletions.
  1. +13 −7 web/utils.py
View
20 web/utils.py
@@ -791,7 +791,7 @@ def safemarkdown(text):
text = markdown(text)
return text
-def sendmail(from_address, to_address, subject, message, headers=None):
+def sendmail(from_address, to_address, subject, message, headers=None, **kw):
"""
Sends the email message `message` with mail and envelope headers
for from `from_address_` to `to_address` with `subject`.
@@ -809,13 +809,19 @@ def sendmail(from_address, to_address, subject, message, headers=None):
webapi = Storage(config=Storage())
if headers is None: headers = {}
+
+ cc = kw.get('cc', [])
+ bcc = kw.get('bcc', [])
+
+ def listify(x):
+ if not isinstance(x, list):
+ return [x]
+ else:
+ return x
- if not isinstance(to_address, list):
- to_address = [to_address]
-
- #@@ should get as arguments
- cc = []
- bcc = []
+ to_address = listify(to_address)
+ cc = listify(cc)
+ bcc = listify(bcc)
recipients = to_address + cc + bcc

0 comments on commit 247d501

Please sign in to comment.
Something went wrong with that request. Please try again.