Permalink
Browse files

Added send a copy to switch.

  • Loading branch information...
alexksikes committed Jul 6, 2009
1 parent aa1719b commit e8e2df1efbc309ab9f1d968b465f10bcd82a2e05
Showing with 7 additions and 3 deletions.
  1. +1 −0 TODO
  2. +1 −1 app/controllers/handle_templates.py
  3. +4 −2 app/models/templates.py
  4. +1 −0 app/views/sendmail_form.html
View
1 TODO
@@ -2,6 +2,7 @@ IMPLEMENT:
- keep a list of message / email address in order to avoid resending to the same email (unless force is checked)
- send a copy to ...
+- demo mode should be a switch in config.py
MORE IDEAS:
@@ -43,5 +43,5 @@ def POST(self):
count = 0
if f.validates():
d = f.d; d.sql_query = web.input().sql_query
- count = templates.send(d.to, d.subject, d.message, d.sql_query, d.reply_to)
+ count = templates.send(d.to, d.subject, d.message, d.sql_query, d.reply_to, d.send_copy)
return view.sendmail_form(f, success=f.valid, count=count)
View
@@ -8,10 +8,12 @@
import re
-def send(to_tpl, subject_tpl, message_tpl, sql_query='', reply_to=''):
+def send(to_tpl, subject_tpl, message_tpl, sql_query='', reply_to='', send_copy=False):
headers = dict(Bcc=config.mail_bcc)
+ if not send_copy:
+ headers = {}
if reply_to: headers['Reply-To'] = reply_to
-
+
count = 1
if not sql_query:
web.sendmail(config.mail_sender, to_tpl, subject_tpl, message_tpl, headers=headers)
@@ -7,6 +7,7 @@
<div class="fixed_input">$get_site_config('mail_sender')</div>
$:form.render_css()
<button name="submit" type="submit" onclick="send_mails()">Send Emails</button>
+$#<button name="submit" type="submit">Send Emails</button>
$#<span id="test_sql_query"><a class="animated" href="javascript:test_sql_query()">Test SQL query &raquo;</a></span>
$#<form method="post" action="/send">

0 comments on commit e8e2df1

Please sign in to comment.