From 4e2f638c5ae8ff5f18ca428010ca99d342bc9681 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Mon, 2 Sep 2019 15:55:22 +0200 Subject: [PATCH] Removed -e option\nFixes:#18 --- massmail | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/massmail b/massmail index 4967401..cf66c05 100755 --- a/massmail +++ b/massmail @@ -56,11 +56,6 @@ Options: -s SEPARATOR set field separator in parameter file, default: ";" - -e ENCODING set PARAMETER_FILE *and* BODY character set - encoding, default: "UTF-8". Note that if you fuck - up this one, your email will be full of rubbish: - You have been warned! - -f fake run: don't really send emails, just print to standard output what would be done. Don't be scared if you can not read the body: it is base64 encoded @@ -85,7 +80,8 @@ Notes: separated list of email addresses. Keep in mind shell escaping when setting headers with white spaces or special characters. - Character set encodings are those supported by python. + Character set encodings are those supported is "UTF-8" + Examples: @@ -125,7 +121,7 @@ def parse_command_line_options(arguments): Arguments are checked for validity. """ try: - opts, args = getopt.getopt(arguments, "hfs:F:S:B:C:R:e:u:p:P:z:") + opts, args = getopt.getopt(arguments, "hfs:F:S:B:C:R:u:p:P:z:") except getopt.GetoptError as err: error(str(err)+USAGE) @@ -137,7 +133,7 @@ def parse_command_line_options(arguments): 'subject': '', 'bcc': '', 'cc': '', - 'encoding': 'utf-8', + #'encoding': 'utf-8', 'smtpuser': None, 'smtppassword': None, 'server': None, @@ -146,8 +142,6 @@ def parse_command_line_options(arguments): } for option, value in opts: - if option == "-e": - options['encoding'] = value if option == "-s": options['sep'] = value elif option == "-F": @@ -244,7 +238,7 @@ def create_email_bodies(options, keywords, email_count, body): lbody = re.sub(r'\$\w+\$', lambda m: keywords[m.group(0)][i], body) # encode body - lbody = email.mime.text.MIMEText(lbody.encode(options['encoding']), 'plain', options['encoding']) + lbody = email.mime.text.MIMEText(lbody.encode('utf-8'), 'plain', 'utf-8') msgs[keywords['$EMAIL$'][i]] = lbody return msgs