define new passCmd config option
allows specifying a command from which the password is queried
This commit is contained in:
parent
1ac6b7c940
commit
4df86a8e8c
2 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
||||||
"port":587,
|
"port":587,
|
||||||
"user":"you@yourmail.com",
|
"user":"you@yourmail.com",
|
||||||
"pass":"yourPassword",
|
"pass":"yourPassword",
|
||||||
|
"passCmd": ["command", "that", "outputs", "the", "password"],
|
||||||
"sender":"santa@yourmail.com",
|
"sender":"santa@yourmail.com",
|
||||||
"price": "75€"
|
"price": "75€"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ from email.utils import formatdate, make_msgid
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import smtplib
|
import smtplib
|
||||||
|
import subprocess
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
import types
|
import types
|
||||||
|
|
||||||
|
@ -123,6 +124,12 @@ def main():
|
||||||
# load mail server configuration
|
# load mail server configuration
|
||||||
with open(args.cFileLocation, 'r') as cFile:
|
with open(args.cFileLocation, 'r') as cFile:
|
||||||
config = json.load(cFile)
|
config = json.load(cFile)
|
||||||
|
passCmd = config.get('passCmd')
|
||||||
|
|
||||||
|
if passCmd is not None:
|
||||||
|
result = subprocess.run(passCmd, stdout=subprocess.PIPE)
|
||||||
|
config['pass'] = result.stdout.decode("utf-8").strip()
|
||||||
|
|
||||||
send_secret_santa_mails(matches, config)
|
send_secret_santa_mails(matches, config)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue