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
0e38c34a
Commit
0e38c34a
authored
Aug 19, 2007
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MailHost now uses zope.sendmail in order to integrate
with Zope transactions
parent
c9f3c5ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
doc/CHANGES.txt
doc/CHANGES.txt
+4
-0
lib/python/Products/MailHost/MailHost.py
lib/python/Products/MailHost/MailHost.py
+14
-14
No files found.
doc/CHANGES.txt
View file @
0e38c34a
...
@@ -64,6 +64,10 @@ Zope Changes
...
@@ -64,6 +64,10 @@ Zope Changes
Features added
Features added
- MailHost: now uses zope.sendmail for delivering the mail providing
integration with the Zope transaction system (avoids sending dupe
emails in case of conflict errors)
- integrated ZODB 3.8
- integrated ZODB 3.8
- integrated Zope 3.4
- integrated Zope 3.4
...
...
lib/python/Products/MailHost/MailHost.py
View file @
0e38c34a
...
@@ -18,7 +18,6 @@ $Id$
...
@@ -18,7 +18,6 @@ $Id$
import
mimetools
import
mimetools
import
rfc822
import
rfc822
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
smtplib
import
SMTP
import
Acquisition
import
Acquisition
import
OFS.SimpleItem
import
OFS.SimpleItem
...
@@ -29,16 +28,16 @@ from AccessControl.Permissions import view_management_screens
...
@@ -29,16 +28,16 @@ from AccessControl.Permissions import view_management_screens
from
AccessControl.Role
import
RoleManager
from
AccessControl.Role
import
RoleManager
from
Globals
import
Persistent
,
DTMLFile
,
InitializeClass
from
Globals
import
Persistent
,
DTMLFile
,
InitializeClass
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
zope.interface
import
implements
from
zope.interface
import
implements
from
zope.sendmail.mailer
import
SMTPMailer
from
zope.sendmail.delivery
import
DirectMailDelivery
from
interfaces
import
IMailHost
from
interfaces
import
IMailHost
class
MailHostError
(
Exception
):
class
MailHostError
(
Exception
):
pass
pass
manage_addMailHostForm
=
DTMLFile
(
'dtml/addMailHost_form'
,
globals
())
manage_addMailHostForm
=
DTMLFile
(
'dtml/addMailHost_form'
,
globals
())
def
manage_addMailHost
(
self
,
id
,
title
=
''
,
smtp_host
=
'localhost'
def
manage_addMailHost
(
self
,
id
,
title
=
''
,
smtp_host
=
'localhost'
,
localhost
=
'localhost'
,
smtp_port
=
25
,
localhost
=
'localhost'
,
smtp_port
=
25
...
@@ -54,8 +53,7 @@ add = manage_addMailHost
...
@@ -54,8 +53,7 @@ add = manage_addMailHost
class
MailBase
(
Acquisition
.
Implicit
,
OFS
.
SimpleItem
.
Item
,
RoleManager
):
class
MailBase
(
Acquisition
.
Implicit
,
OFS
.
SimpleItem
.
Item
,
RoleManager
):
"""a mailhost...?"""
'a mailhost...?'
implements
(
IMailHost
)
implements
(
IMailHost
)
...
@@ -156,20 +154,22 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
...
@@ -156,20 +154,22 @@ class MailBase(Acquisition.Implicit, OFS.SimpleItem.Item, RoleManager):
self
.
_send
(
mfrom
,
mto
,
body
)
self
.
_send
(
mfrom
,
mto
,
body
)
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
)
)
if
self
.
smtp_uid
:
mailer
=
SMTPMailer
(
self
.
smtp_host
,
smtpserver
.
login
(
self
.
smtp_uid
,
self
.
smtp_pwd
)
int
(
self
.
smtp_port
),
smtpserver
.
sendmail
(
mfrom
,
mto
,
messageText
)
self
.
smtp_uid
or
None
,
smtpserver
.
quit
()
self
.
smtp_pwd
or
None
)
delivery
=
DirectMailDelivery
(
mailer
)
delivery
.
send
(
mfrom
,
mto
,
messageText
)
InitializeClass
(
MailBase
)
InitializeClass
(
MailBase
)
class
MailHost
(
Persistent
,
MailBase
):
class
MailHost
(
Persistent
,
MailBase
):
"""persistent version"""
"persistent version"
def
_encode
(
body
,
encode
=
None
):
def
_encode
(
body
,
encode
=
None
):
...
...
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