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
0253530f
Commit
0253530f
authored
Feb 16, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added . quoting
parent
e8555ab0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+16
-6
No files found.
lib/python/Products/MailHost/MailHost.py
View file @
0253530f
...
...
@@ -89,14 +89,14 @@ from socket import *; from select import select
from
AccessControl.Role
import
RoleManager
from
operator
import
truth
import
Acquisition
,
sys
,
ts_regex
,
string
,
types
,
rfc822
import
OFS.SimpleItem
import
OFS.SimpleItem
,
re
,
quopri
import
Globals
from
Scheduler.OneTimeEvent
import
OneTimeEvent
from
ImageFile
import
ImageFile
from
cStringIO
import
StringIO
#$Id: MailHost.py,v 1.3
6 1999/02/16 17:40:26
brian Exp $
__version__
=
"$Revision: 1.3
6
$"
[
11
:
-
2
]
#$Id: MailHost.py,v 1.3
7 1999/02/16 19:13:15
brian Exp $
__version__
=
"$Revision: 1.3
7
$"
[
11
:
-
2
]
smtpError
=
"SMTP Error"
MailHostError
=
"MailHost Error"
...
...
@@ -256,7 +256,9 @@ class MailHost(Persistent, MailBase):
def
Send
(
host
,
port
,
localhost
,
timeout
,
from_
,
to
,
subject
,
body
):
SendMail
(
host
,
port
,
localhost
,
timeout
).
send
(
from_
,
to
,
subject
,
body
)
class
SendMail
:
class
SendMail
:
singledots
=
re
.
compile
(
'^
\
.$
'
)
def __init__(self, smtpHost, smtpPort, localHost="localhost", timeout=1):
self.conn = socket(AF_INET, SOCK_STREAM)
self.conn.connect(smtpHost, smtpPort)
...
...
@@ -309,8 +311,18 @@ class SendMail:
self.conn.send("data
\
015
\
012
")
self._check()
replace=string.replace
body=self.singledots.sub('
..
', body)
body=replace(body, '
\
r
\
n
', '
\
n
')
body=replace(body, '
\
r', '
\
n
')
# This snippet encodes the body as quoted-printable; there
# seem to be some issues with this, so I'
m
leaving
it
out
# for now.
# inbody=StringIO(body)
# outbody=StringIO()
# quopri.encode(inbody, outbody, 0)
# body=outbody.getvalue()
body
=
replace
(
body
,
'
\
n
'
,
'
\
015
\
012
'
)
self
.
conn
.
send
(
body
)
self
.
conn
.
send
(
"
\
015
\
012
.
\
015
\
012
"
)
...
...
@@ -321,8 +333,6 @@ class SendMail:
self
.
conn
.
close
()
bin_search
=
ts_regex
.
compile
(
'[
\
0
-
\
6
\
177
-
\
277
]'
).
search
def
decapitate
(
message
):
# split message into headers / body
mfile
=
StringIO
(
message
)
...
...
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