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
67e5157b
Commit
67e5157b
authored
Aug 15, 2009
by
Alec Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a public method of the email module for generating address lists.
parent
77a3a5a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
src/Products/MailHost/MailHost.py
src/Products/MailHost/MailHost.py
+3
-4
No files found.
src/Products/MailHost/MailHost.py
View file @
67e5157b
...
...
@@ -30,7 +30,6 @@ except ImportError:
import
email.Charset
# We import from a private module here because the email module
# doesn't provide a good public address list parser
from
email._parseaddr
import
AddressList
as
_AddressList
import
uu
from
threading
import
Lock
...
...
@@ -68,6 +67,7 @@ LOG = logging.getLogger('MailHost')
email
.
Charset
.
add_charset
(
"utf-8"
,
email
.
Charset
.
QP
,
email
.
Charset
.
QP
,
"utf-8"
)
formataddr
=
emailutils
.
formataddr
parseaddr
=
emailutils
.
parseaddr
getaddresses
=
emailutils
.
getaddresses
CHARSET_RE
=
re
.
compile
(
'charset=[
\
'
"]?([
\
w-]+)[
\
'"]?', re.IGNORECASE)
class MailHostError(Exception):
...
...
@@ -442,7 +442,7 @@ def _mungeHeaders(messageText, mto=None, mfrom=None, subject=None,
if mto:
if isinstance(mto, basestring):
mto = [formataddr(addr) for addr in
_AddressList(mto).addresslist
]
mto = [formataddr(addr) for addr in
getaddresses((mto,))
]
if not mo.get('To'):
mo['To'] = ', '.join(str(_encode_address_string(e, charset))
for e in mto)
...
...
@@ -452,8 +452,7 @@ def _mungeHeaders(messageText, mto=None, mfrom=None, subject=None,
for header in ('To', 'Cc', 'Bcc'):
v = ','.join(mo.get_all(header) or [])
if v:
mto += [formataddr(addr) for addr in
_AddressList(v).addresslist]
mto += [formataddr(addr) for addr in getaddresses((v,))]
if not mto:
raise MailHostError, "
No
message
recipients
designated
"
...
...
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