Commit ddc3820c authored by Daniel STAN's avatar Daniel STAN

chgpass & stats: utilisation du mail_module

parent 7a1c8627
......@@ -23,7 +23,7 @@ import gestion.affich_tools as affich_tools
import lc_ldap.shortcuts
import lc_ldap.attributs
import lc_ldap.objets
import smtplib
import gestion.mail as mail_module
encoding = getattr(sys.stdout, 'encoding', "UTF-8")
current_user = os.getenv("SUDO_USER") or os.getenv("USER") or os.getenv("LOGNAME") or getpass.getuser()
......@@ -158,9 +158,8 @@ Tentative de changement du mot de passe de %s par %s.
""" % (From, To , login.encode(encoding), current_user)
# Envoi mail
conn = smtplib.SMTP('localhost')
conn.sendmail(From, To , mail )
with mail_module.ServerConnection() as conn:
conn.sendmail(From, To , mail )
# On peut modifier le MDP
......@@ -20,7 +20,6 @@ import gestion.affichage as affichage
import lc_ldap.shortcuts
import psycopg2
import psycopg2.extras
import smtplib
import gestion.config.upload as upload_config
import gestion.config as config
from gestion import mail as mail_module
......@@ -200,7 +199,7 @@ if __name__ == "__main__":
'seuil_upload': upload_config.pretty_seuil,
mail = smtplib.SMTP('localhost')
mail.sendmail(expediteur, destinataire, corps)
with mail_module.ServerConnection() as conn:
conn.sendmail(expediteur, destinataire, corps)
print fetched_upload_srv
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment