wcs-mail-redirection.diff
wcs/qommon/admin/emails.ptl (copie de travail) | ||
---|---|---|
126 | 126 |
html_top('settings', title = _('Emails')) |
127 | 127 |
get_response().breadcrumb.append(('options', _('General Options'))) |
128 | 128 |
'<h2>%s</h2>' % _('General Options') |
129 |
mail_redirection = get_cfg('debug', {}).get('mail_redirection') |
|
130 |
if mail_redirection: |
|
131 |
'<div class="infonotice">' |
|
132 |
'<p>' |
|
133 |
_('Warning: all emails are sent to <%s>') % mail_redirection |
|
134 |
' <a href="../debug_options">%s</a>' % _('Edit') |
|
135 |
'</p>' |
|
136 |
'</div>' |
|
129 | 137 |
form.render() |
130 | 138 |
else: |
131 | 139 |
cfg_submit(form, 'emails', [ 'smtp_server', 'smtp_login', |
wcs/qommon/admin/settings.ptl (copie de travail) | ||
---|---|---|
133 | 133 |
value = debug_cfg.get('logger', False)) |
134 | 134 |
form.add(CheckboxWidget, 'debug_mode', title = _('Enable debug mode'), |
135 | 135 |
value = debug_cfg.get('debug_mode', False)) |
136 |
form.add(StringWidget, 'mail_redirection', title = _('Mail redirection'), |
|
137 |
value = debug_cfg.get('mail_redirection', ''), |
|
138 |
hint=_('If set, send all emails to that address instead of the real recipients')) |
|
136 | 139 |
form.add_submit('submit', _('Submit')) |
137 | 140 |
form.add_submit('cancel', _('Cancel')) |
138 | 141 | |
... | ... | |
146 | 149 |
form.render() |
147 | 150 |
else: |
148 | 151 |
cfg_submit(form, 'debug', ('error_email', 'display_exceptions', |
149 |
'logger', 'debug_mode')) |
|
152 |
'logger', 'debug_mode', 'mail_redirection'))
|
|
150 | 153 |
redirect('.') |
wcs/qommon/emails.py (copie de travail) | ||
---|---|---|
271 | 271 |
if len(rcpts) == 0: |
272 | 272 |
return |
273 | 273 | |
274 |
mail_redirection = get_cfg('debug', {}).get('mail_redirection') |
|
275 |
if mail_redirection: |
|
276 |
rcpts = [mail_redirection] |
|
274 | 277 |
if os.environ.get('QOMMON_MAIL_REDIRECTION'): |
275 | 278 |
# if QOMMON_MAIL_REDIRECTION is set in the environment, send all emails |
276 | 279 |
# to that address instead of the real recipients. |