Details
-
Improvement
-
Resolution: Fixed
-
Major
-
6.0
-
None
Description
Instead of having to write:
#set ($from = $services.mailsender.configuration.fromAddress) #if ("$!from" == '') #set ($from = "no-reply@${request.serverName}") #end #set ($mailTemplateReference = $services.model.createDocumentReference('', 'XWiki', 'ResetPasswordMailContent')) #set ($mailParameters = {'language' : $xcontext.language}) #set ($message = $services.mailsender.createMessage('template', $mailTemplateReference, $mailParameters)) #set ($discard = $message.setFrom($from)) #set ($discard = $message.addRecipients('to', $userEmail)) #set ($discard = $message.addPart("xwiki/template", $mailTemplateReference, $mailParameters)) #set ($discard = $message.send())
The idea is to be able to write:
#set ($from = $services.mailsender.configuration.fromAddress) #if ("$!from" == '') #set ($from = "no-reply@${request.serverName}") #end #set ($mailTemplateReference = $services.model.createDocumentReference('', 'XWiki', 'ResetPasswordMailContent')) #set ($mailParameters = {'language' : $xcontext.language}) #set ($message = $services.mailtemplatesender.createMessage($from, $userEmail, $mailTemplateReference, $mailParameters)) #set ($discard = $message.send())
That means going from 5 API calls to 2 API calls (for this specific use case)