diff --git a/admin/mail_invalide.py b/admin/mail_invalide.py index 08958ae9..ac01d45a 100755 --- a/admin/mail_invalide.py +++ b/admin/mail_invalide.py @@ -3,6 +3,8 @@ import sys,os,string,time,locale locale.setlocale(locale.LC_ALL,'') +sys.path.append("/usr/scripts/gestion") +from email_tools import format_sender # Import de la base de données sys.path.append('/usr/scripts/gestion') @@ -110,9 +112,9 @@ from email.Encoders import encode_base64 msg = MIMEMultipart() msg['Subject'] = "Fiche(s) d'avertissement de mail invalide - %s" % time.strftime("%d/%m/%Y",time.localtime(time.time())) -msg['From'] = "%s <%s>" % (cableur.Nom(), cableur.mail()) -msg['To'] = "Cableurs " -msg['Cc'] = "Disconnect Team " +msg['From'] = format_sender(u"%s <%s>" % (cableur.Nom(), cableur.mail())) +msg['To'] = format_sender(u"Câbleurs ") +msg['Cc'] = format_sender(u"Disconnect Team ") # msg.preamble = text # Guarantees the message ends in a newline # msg.epilogue = '' @@ -123,10 +125,10 @@ img.set_payload(fp.read()) fp.close() encode_base64(img) # Ils auraient pu soigner... img.add_header('Content-Disposition', 'attachment', filename=pdf) -msg.attach(img) text = MIMEText(text, 'plain', 'iso-8859-1') msg.attach(text) +msg.attach(img) while (1 == 1): print "Mail formaté, prêt à l'envoi."