Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
autoprospect
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
Samy Haffoudhi
autoprospect
Commits
7e5fb0af
Commit
7e5fb0af
authored
Feb 06, 2022
by
Samy Haffoudhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lecture d'arguments
parent
db7ec09d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
autoprospect.py
autoprospect.py
+12
-1
No files found.
autoprospect.py
100644 → 100755
View file @
7e5fb0af
#!/bin/python
import
os
import
argparse
import
smtplib
from
email.message
import
EmailMessage
from
sheets
import
get_mails
...
...
@@ -6,6 +9,14 @@ from sheets import get_mails
EMAIL_ADDRESS
=
os
.
environ
.
get
(
'EMAIL_USER'
)
EMAIL_PASSWORD
=
os
.
environ
.
get
(
'EMAIL_PASS'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Un script pour l
\'
envoi automatique de mails à une BDD'
)
parser
.
add_argument
(
"contenu"
,
type
=
str
,
help
=
'fichier contenant le mail à envoyer'
)
parser
.
add_argument
(
'-o'
,
'--objet'
,
type
=
str
,
help
=
'object du mail'
,
default
=
''
)
args
=
parser
.
parse_args
()
contenu
=
args
.
contenu
objet
=
args
.
objet
adresses
=
get_mails
()[
1
:]
with
open
(
'contenu_mail'
,
'r'
)
as
fichier
:
...
...
@@ -16,7 +27,7 @@ with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
for
adresse
in
adresses
:
msg
=
EmailMessage
()
msg
[
'Subject'
]
=
'Message très important'
msg
[
'Subject'
]
=
objet
msg
[
'From'
]
=
EMAIL_ADDRESS
msg
.
set_content
(
contenu
)
msg
[
'To'
]
=
adresse
...
...
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