diff --git a/config.json b/config.json index dd1c212..fef48b4 100644 --- a/config.json +++ b/config.json @@ -3,6 +3,7 @@ "port":587, "user":"you@yourmail.com", "pass":"yourPassword", + "passCmd": ["command", "that", "outputs", "the", "password"], "sender":"santa@yourmail.com", "price": "75€" } diff --git a/wichteln.py b/wichteln.py index 8eccc43..e17a008 100644 --- a/wichteln.py +++ b/wichteln.py @@ -15,6 +15,7 @@ from email.utils import formatdate, make_msgid import json import random import smtplib +import subprocess from typing import Literal import types @@ -123,6 +124,12 @@ def main(): # load mail server configuration with open(args.cFileLocation, 'r') as 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)