Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
dbc879f1
Commit
dbc879f1
authored
Mar 04, 2003
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restored MailHost's ability to send bulk emails using the "Bcc" header to
avoid disclosing the recipients.
parent
23927884
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+9
-9
lib/python/Products/MailHost/tests/testMailHost.py
lib/python/Products/MailHost/tests/testMailHost.py
+8
-0
No files found.
lib/python/Products/MailHost/MailHost.py
View file @
dbc879f1
...
...
@@ -11,8 +11,8 @@
#
##############################################################################
"""SMTP mail objects
$Id: MailHost.py,v 1.7
8 2003/02/22 15:13:32 andreasjung
Exp $"""
__version__
=
"$Revision: 1.7
8
$"
[
11
:
-
2
]
$Id: MailHost.py,v 1.7
9 2003/03/04 16:29:12 shane
Exp $"""
__version__
=
"$Revision: 1.7
9
$"
[
11
:
-
2
]
from
Globals
import
Persistent
,
DTMLFile
,
InitializeClass
from
smtplib
import
SMTP
...
...
@@ -187,13 +187,13 @@ def _mungeHeaders( messageText, mto=None, mfrom=None, subject=None):
if
not
mo
.
getheader
(
'To'
):
mo
[
'To'
]
=
','
.
join
(
mto
)
else
:
if
not
mo
.
getheader
(
'To'
):
raise
MailHostError
,
"Message missing SMTP Header 'To'"
mto
=
map
(
lambda
x
:
x
.
strip
(),
mo
[
'To'
].
split
(
','
)
)
if
mo
.
getheader
(
'Cc'
)
:
mto
=
mto
+
map
(
lambda
x
:
x
.
strip
(),
mo
[
'Cc'
].
split
(
','
))
if
mo
.
getheader
(
'Bcc'
)
:
mto
=
mto
+
map
(
lambda
x
:
x
.
strip
(),
mo
[
'Bcc'
].
split
(
','
))
mto
=
[]
for
header
in
(
'To'
,
'Cc'
,
'Bcc'
):
v
=
mo
.
getheader
(
header
)
if
v
:
mto
+=
[
addr
.
strip
()
for
addr
in
v
.
split
(
','
)]
if
not
mto
:
raise
MailHostError
,
"No message recipients designated"
if
mfrom
:
mo
[
'From'
]
=
mfrom
...
...
lib/python/Products/MailHost/tests/testMailHost.py
View file @
dbc879f1
...
...
@@ -47,6 +47,14 @@ This is the message body."""
self
.
failUnless
(
resto
==
[
'recipient2@domain.com'
])
self
.
failUnless
(
resfrom
==
'sender2@domain.com'
)
def
testBCCHeader
(
self
):
msg
=
"From: me@example.com
\
n
Bcc: many@example.com
\
n
\
n
Message text"
# Specify only the "Bcc" header. Useful for bulk emails.
resmsg
,
resto
,
resfrom
=
_mungeHeaders
(
msg
)
self
.
failUnless
(
resto
==
[
'many@example.com'
])
self
.
failUnless
(
resfrom
==
'me@example.com'
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestMailHost
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment