Commit d34da8dc authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_base: create an Internet Message Post whenever an Email is sent

parent 1d6fd5bb
......@@ -29,4 +29,18 @@ mail_message = portal.Base_createMailMessageAsString(
embedded_file_list=embedded_file_list,
extra_header_dict=extra_header_dict)
event.sendMailHostMessage(mail_message)
internet_message_post_module = portal.getDefaultModuleValue('Internet Message Post', None)
if internet_message_post_module is not None:
# erp5_interface_post is installed, so it is needed to track outgoing emails
internet_message_post = internet_message_post_module.newContent(
portal_type='Internet Message Post',
title="Internet Message for %s" % event.getTitle(),
reference=event.getReference(),
data=mail_message,
)
internet_message_post.allowExport()
event_aggregate_list = event.getAggregateList()
event_aggregate_list.append(internet_message_post.getRelativeUrl())
event.setAggregateList(event_aggregate_list)
else:
event.sendMailHostMessage(mail_message)
......@@ -79,8 +79,23 @@ if download or not use_activity:
embedded_file_list=embedded_file_list,
extra_header_dict=extra_header_dict)
if not use_activity:
context.activate(activity='SQLQueue').sendMailHostMessage(mail_message)
internet_message_post_module = portal.getDefaultModuleValue('Internet Message Post', None)
if internet_message_post_module is not None:
# erp5_interface_post is installed, so it is needed to track outgoing emails
internet_message_post = internet_message_post_module.newContent(
portal_type='Internet Message Post',
title="Internet Message for %s" % context.getTitle(),
reference=context.getReference(),
data=mail_message,
)
internet_message_post.allowExport()
mail_aggregate_list = context.getAggregateList()
mail_aggregate_list.append(internet_message_post.getRelativeUrl())
context.setAggregateList(mail_aggregate_list)
else:
if not use_activity:
context.activate(activity='SQLQueue').sendMailHostMessage(mail_message)
if use_activity:
method_kw = dict(event_relative_url=context.getRelativeUrl(),
......
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