Commit 0664b682 authored by Maxime Bombar's avatar Maxime Bombar

[Scripts] Récupère (et adapte rapidement) scripts d'envoi de mail + git-whatsnew.

parent 7a9c5be1
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
from mail import *
# -*- mode: python; coding: utf-8 -*-
# Source:
import locale
import threading
from datetime import datetime
from contextlib import contextmanager
LOCALE_LOCK = threading.Lock()
def setlocale(name):
saved = locale.setlocale(locale.LC_ALL)
current_val = locale.setlocale(locale.LC_ALL, name)
current_val = saved
print "Warning: Failed setting locale %r" % name
yield current_val
locale.setlocale(locale.LC_ALL, saved)
This diff is collapsed.
#!/bin/bash /usr/scripts/
# -*- coding: utf-8 -*-
import subprocess
#!/bin/bash /usr/scripts/
# -*- mode: python; coding: utf-8 -*-
# TODO: Déprécié soon
# -*- coding: utf-8 -*-
"""API pour envoyer facilement un mail en python
Author: Vincent Le Gallic <>
import sys
if not '/usr/scripts' in sys.path:
#: Pour fabriquer un mail en MIME
from email.mime.text import MIMEText
#: Pour encoder le mail en utf-8
......@@ -14,7 +16,7 @@ from email import Charset
from email.Utils import formatdate
Charset.add_charset('utf-8', Charset.QP, Charset.QP, 'utf-8')
import gestion.mail as mail_module
import mail as mail_module
def create_mail(emetteur, destinataires, objet, message, cc=[], more_headers={}):
"""Fabrique un mail"""
......@@ -61,7 +63,7 @@ class Message(object):
"""Fabrique le mail"""
return create_mail(self.emetteur, self.destinataires, self.objet,
self.corps,, self.more_headers)
def send(self):
"""Envoie le mail"""
return actually_sendmail(self.emetteur, self.destinataires, self.mail())
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