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
fe285619
Commit
fe285619
authored
Jun 07, 2020
by
Nicolas Ollinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout des noms de fichiers dans les log
parent
767c15b6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
17 deletions
+8
-17
.gitignore
.gitignore
+1
-0
mailing.log
mailing.log
+4
-14
mailing.py
mailing.py
+3
-3
No files found.
.gitignore
View file @
fe285619
.DS_Store
__pycache__
*.swp
mailing.log
View file @
fe285619
2020-06-07 14:37:55,068 ==== Début du mailing ====
2020-06-07 14:37:55,276 alice.demo@mailinator.com: OK
2020-06-07 14:37:55,451 bob.demo@mailinator.com: OK
2020-06-07 14:37:55,458 ==== Fin du mailing ====
2020-06-07 14:53:46,688 ==== Début du mailing ====
2020-06-07 14:54:29,406 ==== Début du mailing ====
2020-06-07 14:54:29,609 alice.demo@mailinator.com: OK
2020-06-07 14:54:29,779 bob.demo@mailinator.com: OK
2020-06-07 14:54:29,786 ==== Fin du mailing ====
2020-06-07 14:55:13,281 ==== Début du mailing ====
2020-06-07 14:55:13,471 alice.demo@mailinator.com: OK
2020-06-07 14:55:13,641 bob.demo@mailinator.com: OK
2020-06-07 14:55:13,839 nopid@free.fr: OK
2020-06-07 14:55:13,846 ==== Fin du mailing ====
2020-06-07 15:00:57,650 ==== Début du mailing ====
2020-06-07 15:00:57,835 alice.demo@mailinator.com <- 104.pdf: OK
2020-06-07 15:00:57,996 bob.demo@mailinator.com <- 104.pdf: OK
2020-06-07 15:00:58,003 ==== Fin du mailing ====
mailing.py
View file @
fe285619
...
...
@@ -49,9 +49,9 @@ def envoie(serveur,port,login,mdp,sujet,corps,emet,dest,dobcc,file_path,filename
server
.
login
(
login
,
mdp
)
try
:
server
.
send_message
(
msg
)
logging
.
info
(
'{}
: OK'
.
format
(
dest
))
logging
.
info
(
'{}
<- {}: OK'
.
format
(
dest
,
file_path
))
except
Exception
as
e
:
logging
.
error
(
'{}
: {}'
.
format
(
dest
,
str
(
e
)))
logging
.
error
(
'{}
<- {}: {}'
.
format
(
dest
,
file_path
,
str
(
e
)))
print
(
'ERROR ON {}'
.
format
(
dest
))
logging
.
basicConfig
(
filename
=
'mailing.log'
,
level
=
logging
.
DEBUG
,
format
=
'
%(asctime)
s
%(message)
s'
)
...
...
@@ -59,7 +59,7 @@ logging.info('==== Début du mailing ====')
with
open
(
'mailing.csv'
,
newline
=
''
)
as
f
:
reader
=
csv
.
reader
(
f
)
for
row
in
reader
:
print
(
'{}
...'
.
format
(
row
[
0
]))
print
(
'{}
<- {}...'
.
format
(
row
[
0
],
row
[
1
]))
envoie
(
conf
[
'server'
][
'hostname'
],
int
(
conf
[
'server'
][
'port'
]),
conf
[
'server'
][
'login'
],
conf
[
'server'
][
'passwd'
],
sujet
,
texte
.
format
(
*
row
[
3
:]),
conf
[
'mail'
][
'sender'
],
row
[
0
],
conf
[
'mail'
][
'bcc'
]
==
'true'
,
row
[
1
],
row
[
2
])
logging
.
info
(
'==== Fin du mailing ===='
)
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