Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailing
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
mailing
Commits
02bf5327
Commit
02bf5327
authored
Jun 07, 2020
by
Nicolas Ollinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout du support DSN
parent
d30ea58a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
mailing.conf
mailing.conf
+2
-0
mailing.py
mailing.py
+6
-1
No files found.
mailing.conf
View file @
02bf5327
...
@@ -8,7 +8,9 @@ login: p29719
...
@@ -8,7 +8,9 @@ login: p29719
# la section [mail] contient l'adresse de l'émetteur du mailing
# 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 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
]
[
mail
]
sender
:
Nicolas
Ollinger
<
Nicolas
.
Ollinger
@
univ
-
orleans
.
fr
>
sender
:
Nicolas
Ollinger
<
Nicolas
.
Ollinger
@
univ
-
orleans
.
fr
>
bcc
:
true
bcc
:
true
dsn
:
true
mailing.py
View file @
02bf5327
...
@@ -32,6 +32,8 @@ if 'passwd' not in conf['server']:
...
@@ -32,6 +32,8 @@ if 'passwd' not in conf['server']:
conf
[
'server'
][
'passwd'
]
=
getpass
()
conf
[
'server'
][
'passwd'
]
=
getpass
()
if
'bcc'
not
in
conf
[
'mail'
]:
if
'bcc'
not
in
conf
[
'mail'
]:
conf
[
'mail'
][
'bcc'
]
=
'false'
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
):
def
envoie
(
serveur
,
port
,
login
,
mdp
,
sujet
,
corps
,
emet
,
dest
,
dobcc
,
file_path
,
filename
=
None
):
if
filename
is
None
or
filename
==
''
:
if
filename
is
None
or
filename
==
''
:
...
@@ -51,7 +53,10 @@ def envoie(serveur,port,login,mdp,sujet,corps,emet,dest,dobcc,file_path,filename
...
@@ -51,7 +53,10 @@ def envoie(serveur,port,login,mdp,sujet,corps,emet,dest,dobcc,file_path,filename
with
SMTP_SSL
(
serveur
,
port
)
as
server
:
with
SMTP_SSL
(
serveur
,
port
)
as
server
:
server
.
login
(
login
,
mdp
)
server
.
login
(
login
,
mdp
)
try
:
try
:
server
.
send_message
(
msg
)
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
))
logging
.
info
(
'{} <- {}: OK'
.
format
(
dest
,
file_path
))
except
Exception
as
e
:
except
Exception
as
e
:
logging
.
error
(
'{} <- {}: {}'
.
format
(
dest
,
file_path
,
str
(
e
)))
logging
.
error
(
'{} <- {}: {}'
.
format
(
dest
,
file_path
,
str
(
e
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment