Commit 00f44f0d authored by Daniel STAN's avatar Daniel STAN
Browse files

mail.py: X-Mailer auto

parent ce5dfc7e
......@@ -10,6 +10,7 @@ from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.Utils import formatdate
from markdown import markdown
import inspect
sys.path.append('/usr/scripts/')
from gestion.email_tools import format_sender
......@@ -77,8 +78,19 @@ def body(mail, lang1, lang2, mk, params, charset):
ret.append(submessage(html.encode(charset), 'html', charset))
return ret
def info(msg):
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
return '[%s] %s' % (mod.__name__, msg)
def generate(mail, params, lang=default_language, lang_fallback=default_language, lang_alt='en', charset='utf-8'):
"""Génère un message multipart"""
if 'mailer' not in params:
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
params['mailer'] = os.path.abspath(mod.__file__)
msg = MIMEMultipart('alternative')
if os.path.isdir(template_path + mail):
for filename in [dir for dir in os.listdir(template_path + mail) if os.path.isdir(template_path + mail + '/' + dir)]:
......
Supports Markdown
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