forked from tr4ck3ur/jm2l
Fix automated mail send, avoid utf-8 in title and use send_immediatly method
This commit is contained in:
+2
-3
@@ -46,14 +46,14 @@ def mailer_tasks(config):
|
|||||||
Mail_template = Template(filename='jm2l/templates/mail_html.mako')
|
Mail_template = Template(filename='jm2l/templates/mail_html.mako')
|
||||||
mail_html = Mail_template.render(request=request, User=StaffUser, Contact=Contact, action="Tasks")
|
mail_html = Mail_template.render(request=request, User=StaffUser, Contact=Contact, action="Tasks")
|
||||||
# Prepare Message
|
# 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",
|
sender="contact@jm2l.linux-azur.org",
|
||||||
recipients=[StaffUser.mail],
|
recipients=[StaffUser.mail],
|
||||||
body=mail_plain, html=mail_html)
|
body=mail_plain, html=mail_html)
|
||||||
|
|
||||||
message.add_bcc("spam@style-python.fr")
|
message.add_bcc("spam@style-python.fr")
|
||||||
|
|
||||||
mailer.send(message)
|
mailer.send_immediately(message)
|
||||||
|
|
||||||
def main(global_config, **settings):
|
def main(global_config, **settings):
|
||||||
""" This function returns a Pyramid WSGI application.
|
""" This function returns a Pyramid WSGI application.
|
||||||
@@ -76,7 +76,6 @@ def main(global_config, **settings):
|
|||||||
config.add_subscriber(add_renderer_globals, BeforeRender)
|
config.add_subscriber(add_renderer_globals, BeforeRender)
|
||||||
config.registry['mailer'] = mailer_factory_from_settings(settings)
|
config.registry['mailer'] = mailer_factory_from_settings(settings)
|
||||||
sched = BackgroundScheduler()
|
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.add_job(mailer_tasks, 'cron', day_of_week='fri', hour=18, args=[ config ])
|
||||||
sched.start() # start the scheduler
|
sched.start() # start the scheduler
|
||||||
config.add_renderer('json', JSON(indent=4))
|
config.add_renderer('json', JSON(indent=4))
|
||||||
|
|||||||
@@ -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:
|
% if not t.closed:
|
||||||
<tr>
|
<tr>
|
||||||
<td>${t.due_date.strftime('%d %B %Y').decode('utf-8', 'xmlcharrefreplace')}</td><td>${t.area.name}</td>
|
<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
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
</table>
|
</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:
|
% if not t.closed:
|
||||||
<tr>
|
<tr>
|
||||||
<td>${t.due_date.strftime('%d %B %Y').decode('utf-8', 'xmlcharrefreplace')}</td><td>${t.area.name}</td>
|
<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
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Reference in New Issue
Block a user