Commit aded39e7 authored by Yusei Tahara's avatar Yusei Tahara

Store entire mail message in data property when sending.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20969 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 704da9a3
...@@ -251,12 +251,15 @@ class EmailDocument(File, TextDocument): ...@@ -251,12 +251,15 @@ class EmailDocument(File, TextDocument):
TODO: add support for legacy objects TODO: add support for legacy objects
""" """
if not self.hasFile(): if not self.hasFile() or self._baseGetTextContent() is not None:
# Return the standard text content if no file was provided # Return the standard text content if no file was provided
# Or standard text content is not empty.
if default is _MARKER: if default is _MARKER:
return self._baseGetTextContent() return self._baseGetTextContent()
else: else:
return self._baseGetTextContent(default) return self._baseGetTextContent(default)
# find from mail message
text_result = None text_result = None
html_result = None html_result = None
for part in self._getMessage().walk(): for part in self._getMessage().walk():
...@@ -405,6 +408,7 @@ class EmailDocument(File, TextDocument): ...@@ -405,6 +408,7 @@ class EmailDocument(File, TextDocument):
# #
# Build mail message # Build mail message
# This part will be replaced with MailTemplate soon.
# #
if body is None: if body is None:
body = self.asText() body = self.asText()
...@@ -501,6 +505,9 @@ class EmailDocument(File, TextDocument): ...@@ -501,6 +505,9 @@ class EmailDocument(File, TextDocument):
mail_message = mime_message.as_string() mail_message = mime_message.as_string()
self.activate().sendMailHostMessage(mail_message) self.activate().sendMailHostMessage(mail_message)
# Save one of mail messages.
self.setData(mail_message)
# Only for debugging purpose # Only for debugging purpose
if download: if download:
return mail_message return mail_message
...@@ -515,4 +522,3 @@ class EmailDocument(File, TextDocument): ...@@ -515,4 +522,3 @@ class EmailDocument(File, TextDocument):
## Compatibility layer ## Compatibility layer
#from Products.ERP5Type import Document #from Products.ERP5Type import Document
#Document.MailMessage = EmailDocument #Document.MailMessage = EmailDocument
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment