diff --git a/ddec.py b/ddec.py old mode 100644 new mode 100755 index b205360..d636a23 --- a/ddec.py +++ b/ddec.py @@ -532,7 +532,11 @@ def send_expires_dict_email(): msg = MIMEMultipart("alternative") msg['From'] = SMTP_SENDER msg['To'] = CLI.email_to - msg['Subject'] = "Expiring domains" + subject = "Expiring domains" + if CLI.email_subject: + msg['Subject'] = subject + ": " + CLI.email_subject + else: + msg['Subject'] = subject body_text = "Expiring domains\n%BODY%" body_html = """\ @@ -803,6 +807,12 @@ def process_cli(): metavar="EMAIL" ) parent_group.add_argument( + "-subject", + "--email-subject", + help="Append custom text to the email subject (default is None)", + metavar="STRING" + ) + parent_group.add_argument( "-ssl", "--email-ssl", action="store_true", @@ -869,6 +879,7 @@ def print_namespase(): f"\tUse Telegram : {CLI.use_telegram}\n" f"\tProxy for Telegram : {CLI.proxy}\n" f"\tEmail to : {CLI.email_to}\n" + f"\tEmail subject : {CLI.email_subject}\n" f"\tEmail SSL : {CLI.email_ssl}\n" f"\tEmail AUTH : {CLI.email_auth}\n" f"\tEmail STARTTLS : {CLI.email_starttls}\n" @@ -1345,6 +1356,11 @@ def check_cli_logic(): f"{FLR}You must specify the email address of the recipient. Use the --email_to option") sys.exit(-1) + if CLI.email_subject and (not CLI.email_to): + print( + f"{FLR}You must specify the email address of the recipient. Use the --email_to option") + sys.exit(-1) + if CLI.email_auth and (not CLI.email_to): print( f"{FLR}You must specify the email address of the recipient. Use the --email_to option")