Details
-
Improvement
-
Resolution: Fixed
-
Major
-
6.4
-
None
Description
The problem is that we cannot implement new iterator factories that return Iterator<MimeMessage> and call them from the mail scripting API.
The idea is to generify MimeMessageFactory to support creating Iterator<MimeMessage>.
Current usage of sending a mail template to a group:
## Parameters for the 'template' MimeMessageFactory #set ($templateParameters = {'language' : $xcontext.language, 'velocityVariables' : { 'var1' : 'value1' }}) ## Parameters for the 'group' MimeMessage Iterator Factory #set ($templateReference = $services.model.createDocumentReference('', 'Space', 'MailTemplatePage')) #set ($parameters = {'parameters' : $parameters, 'source' : $templateReference }) #set ($groupReference = $services.model.createDocumentReference('', 'XWiki', 'MyGroup')) #set ($messages = $services.mailsender.createMessages('group', $groupReference, 'template', $parameters)) #set ($mailResult = $services.mailsender.send($messages, 'database'))
And when this issue is implemented:
## Parameters for the 'template' MimeMessageFactory #set ($templateParameters = {'language' : $xcontext.language, 'velocityVariables' : { 'var1' : 'value1' }}) ## Parameters for the 'group' MimeMessageFactory #set ($templateReference = $services.model.createDocumentReference('', 'Space', 'MailTemplatePage')) #set ($groupParameters = {'hint' : 'template', 'parameters' : $templateParameters, 'source' : $templateReference }) #set ($groupReference = $services.model.createDocumentReference('', 'XWiki', 'MyGroup')) #set ($messages = $services.mailsender.createMessages('group', $groupReference, $groupParameters)) #set ($mailResult = $services.mailsender.send($messages, 'database'))