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
a8fbfd86
Commit
a8fbfd86
authored
Sep 16, 1997
by
Jeffrey Shell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New SMTP checking..?
parent
9053f3a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
49 deletions
+17
-49
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+17
-49
No files found.
lib/python/Products/MailHost/MailHost.py
View file @
a8fbfd86
...
...
@@ -4,8 +4,8 @@ from AccessControl.Role import RoleManager
import
Acquisition
,
sys
,
regex
,
string
,
types
import
OFS.SimpleItem
#$Id: MailHost.py,v 1.1
0 1997/09/16 15:51:46
jeffrey Exp $
__version__
=
"$Revision: 1.1
0
$"
[
11
:
-
2
]
#$Id: MailHost.py,v 1.1
1 1997/09/16 16:59:01
jeffrey Exp $
__version__
=
"$Revision: 1.1
1
$"
[
11
:
-
2
]
smtpError
=
"SMTP Error"
MailHostError
=
"MailHost Error"
...
...
@@ -118,9 +118,15 @@ class SendMail:
return
line
def
_check
(
self
,
lev
=
'250'
):
data
=
self
.
getLine
()
if
data
[:
3
]
!=
lev
:
raise
smtpError
,
"Expected %s, got %s from SMTP"
%
(
lev
,
data
[:
3
])
line
=
self
.
getLine
()
try
:
code
=
string
.
atoi
(
line
[:
3
])
except
:
raise
smtpError
,
"Cannot convert line from SMTP: %s"
%
line
if
code
>
500
:
#raise smtpError, "Expected %s, got %s from SMTP" % (lev, data[:3])
raise
smtpError
"Recieved error code %s from SMTP: %s"
%
(
code
,
line
)
def
send
(
self
,
mfrom
,
mto
,
subj
,
body
):
self
.
conn
.
send
(
"mail from:<%s>
\
n
"
%
mfrom
)
...
...
@@ -170,53 +176,15 @@ def newDecapitate(message):
body=string.join(maxwell[linecount:],'
\
n
')
return headerDict, body
def decapitate(message,
header_re=regex.compile(
'
\
(
\
(
'
'
[
^
\
0
-
<>
:]
+
:[
^
\
n
]
*
\
n
'
'
\
|
'
'
[
\
t
]
+
[
^
\
0
-
][
^
\
n
]
*
\
n
'
'
\
)
+
\
)[
\
t
]
*
\
n
\
([
\
0
-
\
377
]
+
\
)
'
),
#r'
(([
^
\
0
-
<>
:]
+
:[
^
\
n
]
*
\
n
|
[
\
t
]
+
[
^
\
0
-
][
^
\
n
]
*
\
n
)
+
)[
\
t
]
*
\
n
([
\
0
-
\
377
]
+
)
'
space_re=regex.compile('
\
([
\
t
]
+
\
)
'),
name_re=regex.compile('
\
([
^
\
0
-
<>
:]
+
\
):
\
([
^
\
n
]
*
\
)
'),
):
if header_re.match(message) < 0: return message
headers, body = header_re.group(1,3)
headers=string.split(headers,'
\
n
')
headerDict={}
i=1
while i < len(headers):
if not headers[i]:
del headers[i]
elif space_re.match(headers[i]) >= 0:
headers[i-1]="%s %s" % (headers[i-1],
headers[i][len(space_re.group(1)):])
del headers[i]
else:
i=i+1
def decapitate(message, **kw):
#left behind for bw-compatibility
return newDecapitate(message)
for i in range(len(headers)):
if name_re.match(headers[i]) >= 0:
k, v = name_re.group(1,2)
k=string.lower(k); v=string.strip(v)
headerDict[k]=v
else:
raise ValueError, '
Invalid
Header
(
%
d
):
%
s
' % (i,headers[i])
if headerDict.has_key('
to
'):
headerDict['
to
']=map(
lambda x: string.strip(x),
string.split(headerDict['
to
'], '
,
')
)
return (headerDict, body)
#$Log: MailHost.py,v $
#Revision 1.11 1997/09/16 16:59:01 jeffrey
#New SMTP checking..?
#
#Revision 1.10 1997/09/16 15:51:46 jeffrey
#(Hopefully) fixed some socket problems
#
...
...
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