Skip to content

Commit 3c22e5c

Browse files
authored
Merge pull request #84 from ASPP/add-cc-header
Added Cc header.
2 parents e7a240c + 1d7541b commit 3c22e5c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

massmail

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Options:
4848
-B BCC set the Bcc: header for all messages.
4949
Must be ASCII
5050
51+
-C CC set the Cc: header for all messages.
52+
Must be ASCII
53+
5154
-R In-Reply-To set the In-Reply-To: takes a Message-ID as input
5255
5356
-s SEPARATOR set field separator in parameter file,
@@ -122,7 +125,7 @@ def parse_command_line_options(arguments):
122125
Arguments are checked for validity.
123126
"""
124127
try:
125-
opts, args = getopt.getopt(arguments, "hfs:F:S:B:R:e:u:p:P:z:")
128+
opts, args = getopt.getopt(arguments, "hfs:F:S:B:C:R:e:u:p:P:z:")
126129
except getopt.GetoptError as err:
127130
error(str(err)+USAGE)
128131

@@ -133,6 +136,7 @@ def parse_command_line_options(arguments):
133136
'from': '',
134137
'subject': '',
135138
'bcc': '',
139+
'cc': '',
136140
'encoding': 'utf-8',
137141
'smtpuser': None,
138142
'smtppassword': None,
@@ -152,6 +156,8 @@ def parse_command_line_options(arguments):
152156
options['subject'] = value
153157
elif option == "-B":
154158
options['bcc'] = value
159+
elif option == "-C":
160+
options['cc'] = value
155161
elif option == "-R":
156162
options['in_reply_to'] = value
157163
elif option == "-h":
@@ -255,6 +261,8 @@ def add_email_headers(options, msgs):
255261
msg['Subject'] = email.header.Header(options['subject'].encode(options['encoding']), options['encoding'])
256262
if options['in_reply_to']:
257263
msg['In-Reply-To'] = email.header.Header(options['in_reply_to'])
264+
if options['cc']:
265+
msg['Cc'] = email.header.Header(options['cc'])
258266
msgs[emailaddr] = msg
259267

260268
return None

0 commit comments

Comments
 (0)