diff --git a/gestion/mail/convocation_age.py b/gestion/mail/convocation_age.py new file mode 100755 index 00000000..69ee3471 --- /dev/null +++ b/gestion/mail/convocation_age.py @@ -0,0 +1,67 @@ +#!/bin/bash /usr/scripts/python.sh +# -*- coding: utf-8 -*- + +import os +import sys +import smtplib +from gestion import config +from gestion.affich_tools import cprint +from gestion import mail +import time +import lc_ldap.shortcuts +import lc_ldap.crans_utils as crans_utils +from email.header import Header +from email.mime.application import MIMEApplication +from utils.sendmail import actually_sendmail + +STATUTS_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "template/age/statuts.pdf") +RI_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "template/age/reglement.pdf") + +# Attention, si à True envoie effectivement les mails +SEND=('--do-it' in sys.argv) +# Prévisualisation +PREV=('--prev' in sys.argv) + +ldap_filter=u"(&(finAdhesion>=%(date)s)(aid=*))" % {'date': crans_utils.to_generalized_time_format(time.time())} +#ldap_filter=u"(|(uid=dstan)(uid=lasseri))" + +conn=lc_ldap.shortcuts.lc_ldap_readonly() +mailaddrs=set() +for adh in conn.search(ldap_filter, sizelimit=2000): + _mail = adh.get_mail() + if _mail is None: + print "%r has no valid contact email." % (adh,) + continue + mailaddrs.add(str(_mail)) + +echecs=[] +From = 'ca@crans.org' +for To in mailaddrs: + cprint(u"Envoi du mail à %s" % To) + mailtxt = mail.generate('age', {'To':To, 'From': From}) + mailtxt["Reply-To"] = Header("ca@crans.org") + + fichier = open(STATUTS_PATH, 'rb') + part = MIMEApplication(fichier.read(), 'pdf') + part.add_header('Content-Disposition', 'attachment', filename="statuts.pdf") + mailtxt.attach(part) + fichier = open(RI_PATH, 'rb') + part = MIMEApplication(fichier.read(), 'pdf') + part.add_header('Content-Disposition', 'attachment', filename="reglement.pdf") + mailtxt.attach(part) + + if PREV: + print mailtxt.as_string() + try: + if SEND: + actually_sendmail('bureau@crans.org', (To,), mailtxt) + cprint(" Envoyé !") + else: + cprint(" (simulé)") + except: + cprint(u"Erreur lors de l'envoi à %s " % To, "rouge") + echecs.append(To) + +if echecs: + print "\nIl y a eu des erreurs :" + print echecs diff --git a/gestion/mail/template/age/From/fr b/gestion/mail/template/age/From/fr new file mode 100644 index 00000000..2510ed39 --- /dev/null +++ b/gestion/mail/template/age/From/fr @@ -0,0 +1 @@ +Le CA du Crans <{{From}}> diff --git a/gestion/mail/template/age/Subject/fr b/gestion/mail/template/age/Subject/fr new file mode 100644 index 00000000..a901ad40 --- /dev/null +++ b/gestion/mail/template/age/Subject/fr @@ -0,0 +1 @@ +[Crans] Modification des statuts et du règlement intérieur : convocation en assemblée générale extraordinaire. diff --git a/gestion/mail/template/age/To/fr b/gestion/mail/template/age/To/fr new file mode 100644 index 00000000..38476730 --- /dev/null +++ b/gestion/mail/template/age/To/fr @@ -0,0 +1 @@ +{{To}} diff --git a/gestion/mail/template/age/X-Mailer/fr b/gestion/mail/template/age/X-Mailer/fr new file mode 100644 index 00000000..f5d9c869 --- /dev/null +++ b/gestion/mail/template/age/X-Mailer/fr @@ -0,0 +1 @@ +{{ mailer }} diff --git a/gestion/mail/template/age/body/en b/gestion/mail/template/age/body/en new file mode 100644 index 00000000..df26695d --- /dev/null +++ b/gestion/mail/template/age/body/en @@ -0,0 +1,32 @@ +Dear members, + +In order to be able to follow ENS Cachan when it'll move to Saclay, Crans need +to reform its statutes and rules of procedure. + +We therefore rewrote these texts, as it was an opportunity to clarify the way +the association is supposed to work, inside and towards external entities. These +new texts explicitly contains a lot of guarantees about how it works, espcially +regarding privacy (which tends to become a big deal nowadays). + +Yet, due to timing issues, we need to have an extraordinary assembly to vote +these texts on Thursday, July 9th at 7.00 pm (local time). This would allow us +to begin some files regarding Saclay project. + +However, we are aware that a lot of our members won't be able to come to vote. +Furthermore, these new texts haven't been translated into English for now. +Anyway, as it is a duty, these new versions are attached to the current email. +If you're interested in, you may contact us in order to ask some questions about +these new texts or the assembly. You just need to answer that email. + +Previous versions of statutes and rules of procedure may be found there: +https://wiki.crans.org/CransAdministratif/StatutsDuCrans +https://wiki.crans.org/CransAdministratif/R%C3%A8glementInt%C3%A9rieur + +The votes will occur all the day in Hall Villon, starting at 9.00 am (local +time). The assembly will be held in Amphithéâtre Tocqueville, and its goal will +be to account the votes of the day. + +Sincerely, + +-- +Crans active members diff --git a/gestion/mail/template/age/body/fr b/gestion/mail/template/age/body/fr new file mode 100644 index 00000000..7c5539ce --- /dev/null +++ b/gestion/mail/template/age/body/fr @@ -0,0 +1,37 @@ +Chers adhérents, + +Dans le but de pouvoir nous investir dans le projet Paris-Saclay et ainsi +accompagner le déménagement de l'Ecole Normale Supérieure de Cachan, +l'association doit adapter ses statuts et son règlement intérieur. + +Nous avons donc travaillé à leur réécriture, qui vise aussi à clarifier la façon +dont l'association fonctionne, aussi bien en interne que vers les personnes +extérieures à l'association. Ainsi un certain nombre de garanties sont désormais +exprimées explicitement dans les statuts ou le règlement intérieur, en +particulier sur la notion de vie privée (qui est en ce moment au cœur des débats +publics). + +Cependant, le temps manque, et nous aimerions pouvoir également mener les +démarches nécessaires dans le cadre du projet Saclay, y compris auprès des +établissements publics concernés. Aussi, nous souhaiterions voter ces +modifications lors d'une Assemblée Générale Extraordinaire qui se tiendrait le +jeudi 9 juillet 2015 à 19h. + +Nous avons conscience que ce choix signifie aussi qu'un certain nombre d'entre +vous ne pourront pas nécessairement être présents. Les textes que nous +souhaitons adopter sont en pièce jointe du présent email. Si vous voyez des +choses qui vous semblent problématiques dans l'un d'entre eux, n'hésitez pas à +nous contacter par email (en répondant à celui-ci) pour exprimer votre pensée. + +Les précédents statuts et règlement intérieur peuvent être trouvés ici : +https://wiki.crans.org/CransAdministratif/StatutsDuCrans +https://wiki.crans.org/CransAdministratif/R%C3%A8glementInt%C3%A9rieur + +Vous pourrez vous rendre au Hall Villon à partir de 9h (heure locale) pour voter +concernant l'adoption des nouveaux textes. L'assemblée se tiendra à +l'amphithéâtre Tocqueville dans le but de dépouiller les votes. + +Bien cordialement, + +-- +Les membres actifs du Crans diff --git a/gestion/mail/template/age/reglement.pdf b/gestion/mail/template/age/reglement.pdf new file mode 100644 index 00000000..5c410d55 Binary files /dev/null and b/gestion/mail/template/age/reglement.pdf differ diff --git a/gestion/mail/template/age/statuts.pdf b/gestion/mail/template/age/statuts.pdf new file mode 100644 index 00000000..0ea09806 Binary files /dev/null and b/gestion/mail/template/age/statuts.pdf differ