Browse Source

Fix automated mail send, avoid utf-8 in title and use send_immediatly method

master
tr4ck3ur des JM2L 9 years ago
parent
commit
7fc5227ecd
2 changed files with 4 additions and 5 deletions
  1. +2
    -3
      jm2l/__init__.py
  2. +2
    -2
      jm2l/templates/mail_html.mako

+ 2
- 3
jm2l/__init__.py View File

@@ -46,14 +46,14 @@ def mailer_tasks(config):
Mail_template = Template(filename='jm2l/templates/mail_html.mako')
mail_html = Mail_template.render(request=request, User=StaffUser, Contact=Contact, action="Tasks")
# Prepare Message
message = Message(subject="[JM2L] Rappel des Tâches pour les JM2L".decode('utf-8'),
message = Message(subject="[JM2L] Le mail de rappel pour les JM2L !",
sender="contact@jm2l.linux-azur.org",
recipients=[StaffUser.mail],
body=mail_plain, html=mail_html)
message.add_bcc("spam@style-python.fr")
mailer.send(message)
mailer.send_immediately(message)

def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
@@ -76,7 +76,6 @@ def main(global_config, **settings):
config.add_subscriber(add_renderer_globals, BeforeRender)
config.registry['mailer'] = mailer_factory_from_settings(settings)
sched = BackgroundScheduler()
#sched.add_job(mailer_tasks, 'interval', minutes=1, args=[ config ])
sched.add_job(mailer_tasks, 'cron', day_of_week='fri', hour=18, args=[ config ])
sched.start() # start the scheduler
config.add_renderer('json', JSON(indent=4))


+ 2
- 2
jm2l/templates/mail_html.mako View File

@@ -92,7 +92,7 @@ Voici ce qu'il y'a dans la liste des tâches qui te sont assignées:
% if not t.closed:
<tr>
<td>${t.due_date.strftime('%d %B %Y').decode('utf-8', 'xmlcharrefreplace')}</td><td>${t.area.name}</td>
<td><a href="//jm2l.linux-azur.org/Staff/tasks/${t.uid}">${t.name}</a>
<td><a href="http://jm2l.linux-azur.org/Staff/tasks/${t.uid}">${t.name}</a>
% endif
% endfor
</table>
@@ -103,7 +103,7 @@ Voici ce qu'il y'a dans la liste des tâches qui te sont assignées:
% if not t.closed:
<tr>
<td>${t.due_date.strftime('%d %B %Y').decode('utf-8', 'xmlcharrefreplace')}</td><td>${t.area.name}</td>
<td><a href="//jm2l.linux-azur.org/Staff/tasks/${t.uid}">${t.name}</a>
<td><a href="http://jm2l.linux-azur.org/Staff/tasks/${t.uid}">${t.name}</a>
% endif
% endfor
</table>


Loading…
Cancel
Save