Commit 02bf5327 authored by Nicolas Ollinger's avatar Nicolas Ollinger

ajout du support DSN

parent d30ea58a
......@@ -8,7 +8,9 @@ login: p29719
# la section [mail] contient l'adresse de l'émetteur du mailing
# le champ bcc (true/false) indique si l'émetteur doit être en copie cachée des messages
# le champ dsn (true/false) indique si l'émetteur souhaite recevoir un rapport d'émission
[mail]
sender: Nicolas Ollinger <Nicolas.Ollinger@univ-orleans.fr>
bcc: true
dsn: true
......@@ -32,6 +32,8 @@ if 'passwd' not in conf['server']:
conf['server']['passwd']=getpass()
if 'bcc' not in conf['mail']:
conf['mail']['bcc']='false'
if 'dsn' not in conf['mail']:
conf['mail']['dsn']='false'
def envoie(serveur,port,login,mdp,sujet,corps,emet,dest,dobcc,file_path,filename=None):
if filename is None or filename=='':
......@@ -51,6 +53,9 @@ def envoie(serveur,port,login,mdp,sujet,corps,emet,dest,dobcc,file_path,filename
with SMTP_SSL(serveur,port) as server:
server.login(login,mdp)
try:
if conf['mail']['dsn']=='true':
server.send_message(msg,rcpt_options=['NOTIFY=SUCCESS,DELAY,FAILURE'])
else:
server.send_message(msg)
logging.info('{} <- {}: OK'.format(dest,file_path))
except Exception as e:
......
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