forked from DGNum/gestioCOF
Meilleure gestion des données mails
Les valeurs de champs FROM, REPLY-TO et BCC des mails envoyés par GestioCOF sont enregistrées dans un dictionnaire `settings.MAIL_DATA` plutôt que d'être toutes enregistrées comme variables indépendantes
This commit is contained in:
parent
421368d2c9
commit
7abdccfbdb
3 changed files with 26 additions and 18 deletions
|
@ -119,8 +119,9 @@ class Spectacle(models.Model):
|
||||||
'show': self})
|
'show': self})
|
||||||
mail_tot = mail.EmailMessage(
|
mail_tot = mail.EmailMessage(
|
||||||
mail_object, mail_body,
|
mail_object, mail_body,
|
||||||
settings.RAPPEL_FROM, [member.email],
|
settings.MAIL_DATA['rappels']['FROM'], [member.email],
|
||||||
[], headers={'Reply-To': settings.RAPPEL_REPLY_TO})
|
[], headers={
|
||||||
|
'Reply-To': settings.MAIL_DATA['rappels']['REPLYTO']})
|
||||||
mails_to_send.append(mail_tot)
|
mails_to_send.append(mail_tot)
|
||||||
# On envoie les mails
|
# On envoie les mails
|
||||||
connection = mail.get_connection()
|
connection = mail.get_connection()
|
||||||
|
@ -273,8 +274,10 @@ class SpectacleRevente(models.Model):
|
||||||
'revente': self})
|
'revente': self})
|
||||||
mail_tot = mail.EmailMessage(
|
mail_tot = mail.EmailMessage(
|
||||||
mail_object, mail_body,
|
mail_object, mail_body,
|
||||||
settings.REVENTE_FROM, [participant.user.email],
|
settings.MAIL_DATA['revente']['FROM'],
|
||||||
[], headers={'Reply-To': settings.REVENTE_REPLY_TO})
|
[participant.user.email],
|
||||||
|
[], headers={
|
||||||
|
'Reply-To': settings.MAIL_DATA['revente']['REPLYTO']})
|
||||||
mails_to_send.append(mail_tot)
|
mails_to_send.append(mail_tot)
|
||||||
|
|
||||||
connection = mail.get_connection()
|
connection = mail.get_connection()
|
||||||
|
@ -294,8 +297,10 @@ class SpectacleRevente(models.Model):
|
||||||
'mail': self.attribution.participant.user.email})
|
'mail': self.attribution.participant.user.email})
|
||||||
mail_tot = mail.EmailMessage(
|
mail_tot = mail.EmailMessage(
|
||||||
mail_object, mail_body,
|
mail_object, mail_body,
|
||||||
settings.REVENTE_FROM, [participant.user.email],
|
settings.MAIL_DATA['revente']['FROM'],
|
||||||
[], headers={'Reply-To': settings.REVENTE_REPLY_TO})
|
[participant.user.email],
|
||||||
|
[], headers={
|
||||||
|
'Reply-To': settings.MAIL_DATA['revente']['REPLYTO']})
|
||||||
mails_to_send.append(mail_tot)
|
mails_to_send.append(mail_tot)
|
||||||
|
|
||||||
connection = mail.get_connection()
|
connection = mail.get_connection()
|
||||||
|
|
|
@ -145,15 +145,18 @@ ADMIN_MEDIA_PREFIX = '/static/grappelli/'
|
||||||
GRAPPELLI_ADMIN_HEADLINE = "GestioCOF"
|
GRAPPELLI_ADMIN_HEADLINE = "GestioCOF"
|
||||||
GRAPPELLI_ADMIN_TITLE = "<a href=\"/\">GestioCOF</a>"
|
GRAPPELLI_ADMIN_TITLE = "<a href=\"/\">GestioCOF</a>"
|
||||||
|
|
||||||
PETITS_COURS_FROM = "Le COF <cof@ens.fr>"
|
MAIL_DATA = {
|
||||||
PETITS_COURS_BCC = "archivescof@gmail.com"
|
'petits_cours': {
|
||||||
PETITS_COURS_REPLYTO = "cof@ens.fr"
|
'FROM': "Le COF <cof@ens.fr>",
|
||||||
|
'BCC': "archivescof@gmail.com",
|
||||||
RAPPEL_FROM = 'Le BdA <bda@ens.fr>'
|
'REPLYTO': "cof@ens.fr"},
|
||||||
RAPPEL_REPLY_TO = RAPPEL_FROM
|
'rappels': {
|
||||||
|
'FROM': 'Le BdA <bda@ens.fr>',
|
||||||
REVENTE_FROM = 'BDA-Revente <bda-revente@ens.fr>'
|
'REPLYTO': 'Le BdA <bda@ens.fr>'},
|
||||||
REVENTE_REPLY_TO = REVENTE_FROM
|
'revente': {
|
||||||
|
'FROM': 'BDA-Revente <bda-revente@ens.fr>',
|
||||||
|
'REPLYTO': 'BDA-Revente <bda-revente@ens.fr>'},
|
||||||
|
}
|
||||||
|
|
||||||
LOGIN_URL = "/gestion/login"
|
LOGIN_URL = "/gestion/login"
|
||||||
LOGIN_REDIRECT_URL = "/gestion/"
|
LOGIN_REDIRECT_URL = "/gestion/"
|
||||||
|
|
|
@ -282,9 +282,9 @@ def _traitement_post(request, demande):
|
||||||
{"proposals": proposals_list,
|
{"proposals": proposals_list,
|
||||||
"unsatisfied": unsatisfied,
|
"unsatisfied": unsatisfied,
|
||||||
"extra": extra})
|
"extra": extra})
|
||||||
frommail = settings.PETITS_COURS_FROM
|
frommail = settings.MAIL_DATA['petits_cours']['FROM']
|
||||||
bccaddress = settings.PETITS_COURS_BCC
|
bccaddress = settings.MAIL_DATA['petits_cours']['BCC']
|
||||||
replyto = settings.PETITS_COURS_REPLYTO
|
replyto = settings.MAIL_DATA['petits_cours']['REPLYTO']
|
||||||
mails_to_send = []
|
mails_to_send = []
|
||||||
for (user, msg) in proposed_mails:
|
for (user, msg) in proposed_mails:
|
||||||
msg = EmailMessage("Petits cours ENS par le COF", msg,
|
msg = EmailMessage("Petits cours ENS par le COF", msg,
|
||||||
|
|
Loading…
Reference in a new issue