* Formatage correct des en-ttes

* Texte mis avant la pice jointe

darcs-hash:20060208180142-68412-10993d6306111e1266ecd5ca3ceaeff6b0fb9baf.gz
This commit is contained in:
glondu 2006-02-08 19:01:42 +01:00
parent 09983cde5d
commit 22bd695a26

View file

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