Skip to content

Commit

Permalink
Added send a copy to switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexksikes committed Jul 6, 2009
1 parent aa1719b commit e8e2df1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/handle_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 4 additions & 2 deletions app/models/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions app/views/sendmail_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit e8e2df1

Please sign in to comment.