diff --git a/lib/pyulib/src/uapps/umail.py b/lib/pyulib/src/uapps/umail.py index 23e9452..d0e75af 100755 --- a/lib/pyulib/src/uapps/umail.py +++ b/lib/pyulib/src/uapps/umail.py @@ -77,6 +77,7 @@ def run_umail(): ('a:', 'attach=', "Attacher un fichier"), ('t:', 'content-type=', "Spécifier le type de contenu du fichier"), ('f:', 'body=', "Spécifier un fichier contenant le corps du message"), + (None, 'html', "Indiquer que le corps du message est du type text/html. Par défaut, il s'agit de text/plain"), (None, 'gencmd', "Générer une commande à évaluer pour envoyer le mail"), ]) options, args = get_args(None, options, longoptions) @@ -87,6 +88,7 @@ def run_umail(): mbccs = [] body = None bodyfile = None + bodymtype = 'plain' afiles = [] amimetypes = [] gencmd = False @@ -110,6 +112,8 @@ def run_umail(): bodyfile = None elif not path.exists(bodyfile): die("%s: fichier introuvable" % bodyfile) + elif option in ('--html',): + bodymtype = 'html' elif option in ('--gencmd',): gencmd = True @@ -133,14 +137,14 @@ def run_umail(): if not afiles: # Sans attachement, faire un message simple - msg = MIMEText('\n'.join(lines), 'plain') + msg = MIMEText('\n'.join(lines), bodymtype) msg.set_charset('utf-8') else: # Il y a des attachement, faire un multipart msg = MIMEMultipart() #msg.set_charset('utf-8') if lines: - body = MIMEText('\n'.join(lines), 'plain') + body = MIMEText('\n'.join(lines), bodymtype) body.set_charset('utf-8') msg.attach(body) i = 0