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
ed3787f0
Commit
ed3787f0
authored
Dec 18, 2003
by
Lennart Regebro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for ESMTP user+password authorization.
parent
677dc39d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
doc/CHANGES.txt
doc/CHANGES.txt
+5
-1
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+14
-5
No files found.
doc/CHANGES.txt
View file @
ed3787f0
...
@@ -23,6 +23,10 @@ Zope Changes
...
@@ -23,6 +23,10 @@ Zope Changes
directly, this speeding the use of the slot.
directly, this speeding the use of the slot.
Features added
Features added
- MailHost now has two additional properties, a user id and a
password. These are used to attempt ESMTP authentication
before sending a mail.
- Folder listings in FTP now include "." as well as "..".
- Folder listings in FTP now include "." as well as "..".
...
@@ -634,7 +638,7 @@ Zope Changes
...
@@ -634,7 +638,7 @@ Zope Changes
- Made all PluginIndexes and ZCTextIndex use 'safe_callable',
- Made all PluginIndexes and ZCTextIndex use 'safe_callable',
which is aware of extension classes that fill 'tp_callable'
which is aware of extension classes that fill 'tp_callable'
but don't define '__call__'.
but don't define '__call__'.
- Made KeywordIndex be more robust about receiving a value that
- Made KeywordIndex be more robust about receiving a value that
is not a string or an iterable type.
is not a string or an iterable type.
...
...
lib/python/Products/MailHost/MailHost.py
View file @
ed3787f0
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
#
#
##############################################################################
##############################################################################
"""SMTP mail objects
"""SMTP mail objects
$Id: MailHost.py,v 1.8
1 2003/11/18 13:17:05 tseaver
Exp $"""
$Id: MailHost.py,v 1.8
2 2003/12/18 21:42:06 regebro
Exp $"""
__version__
=
"$Revision: 1.8
1
$"
[
11
:
-
2
]
__version__
=
"$Revision: 1.8
2
$"
[
11
:
-
2
]
from
Globals
import
Persistent
,
DTMLFile
,
InitializeClass
from
Globals
import
Persistent
,
DTMLFile
,
InitializeClass
from
smtplib
import
SMTP
from
smtplib
import
SMTP
...
@@ -49,6 +49,8 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -49,6 +49,8 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
manage_main
.
_setName
(
'manage_main'
)
manage_main
.
_setName
(
'manage_main'
)
index_html
=
None
index_html
=
None
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
smtp_uid
=
''
# Class attributes for smooth upgrades
smtp_pwd
=
''
timeout
=
1.0
timeout
=
1.0
...
@@ -63,12 +65,15 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -63,12 +65,15 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
)
)
def
__init__
(
self
,
id
=
''
,
title
=
''
,
smtp_host
=
'localhost'
,
smtp_port
=
25
):
def
__init__
(
self
,
id
=
''
,
title
=
''
,
smtp_host
=
'localhost'
,
smtp_port
=
25
,
smtp_uid
=
''
,
smtp_pwd
=
''
):
"""Initialize a new MailHost instance """
"""Initialize a new MailHost instance """
self
.
id
=
id
self
.
id
=
id
self
.
title
=
title
self
.
title
=
title
self
.
smtp_host
=
str
(
smtp_host
)
self
.
smtp_host
=
str
(
smtp_host
)
self
.
smtp_port
=
int
(
smtp_port
)
self
.
smtp_port
=
int
(
smtp_port
)
self
.
smtp_uid
=
smtp_uid
self
.
smtp_pwd
=
smtp_pwd
# staying for now... (backwards compatibility)
# staying for now... (backwards compatibility)
...
@@ -78,7 +83,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -78,7 +83,7 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
security
.
declareProtected
(
'Change configuration'
,
'manage_makeChanges'
)
security
.
declareProtected
(
'Change configuration'
,
'manage_makeChanges'
)
def
manage_makeChanges
(
self
,
title
,
smtp_host
,
smtp_port
,
REQUEST
=
None
):
def
manage_makeChanges
(
self
,
title
,
smtp_host
,
smtp_port
,
smtp_uid
,
smtp_pwd
,
REQUEST
=
None
):
'make the changes'
'make the changes'
title
=
str
(
title
)
title
=
str
(
title
)
...
@@ -88,6 +93,8 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -88,6 +93,8 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
self
.
title
=
title
self
.
title
=
title
self
.
smtp_host
=
smtp_host
self
.
smtp_host
=
smtp_host
self
.
smtp_port
=
smtp_port
self
.
smtp_port
=
smtp_port
self
.
smtp_uid
=
smtp_uid
self
.
smtp_pwd
=
smtp_pwd
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
msg
=
'MailHost %s updated'
%
self
.
id
msg
=
'MailHost %s updated'
%
self
.
id
return
self
.
manage_main
(
self
return
self
.
manage_main
(
self
...
@@ -141,7 +148,9 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -141,7 +148,9 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
security
.
declarePrivate
(
'_send'
)
security
.
declarePrivate
(
'_send'
)
def
_send
(
self
,
mfrom
,
mto
,
messageText
):
def
_send
(
self
,
mfrom
,
mto
,
messageText
):
""" Send the message """
""" Send the message """
smtpserver
=
SMTP
(
self
.
smtp_host
,
int
(
self
.
smtp_port
)
)
smtpserver
=
SMTP
(
self
.
smtp_host
,
int
(
self
.
smtp_port
)
)
if
self
.
smtp_uid
:
smtpserver
.
login
(
self
.
smtp_uid
,
self
.
smtp_pwd
)
smtpserver
.
sendmail
(
mfrom
,
mto
,
messageText
)
smtpserver
.
sendmail
(
mfrom
,
mto
,
messageText
)
smtpserver
.
quit
()
smtpserver
.
quit
()
...
...
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