Description
Example usage (make sure the template doesn't exist):
#set ($templateParameters = {'type' : 'SendAll', 'language' : $xcontext.language }) #set ($templateReference = $services.model.createDocumentReference('', 'Admin', 'MailTemplate')) #set ($parameters = {'hint' : 'template', 'parameters' : $templateParameters, 'source' : $templateReference }) #set ($groupReference = $services.model.createDocumentReference('', 'XWiki', 'XWikiAllGroup')) #set ($source = {'groups' : [$groupReference]}) #set ($messages = $services.mailsender.createMessages('usersandgroups', $source, $parameters)) #set ($mailResult = $services.mailsender.send($messages, 'database'))
Result:
2017-10-06 12:23:09,186 [Mail Prepare Thread] ERROR o.x.m.i.DatabaseMailListener - Failure during preparation phase of thread [f7e754d7-ab68-4c58-842c-12b5a81f549a] java.lang.NullPointerException: null at org.xwiki.mail.internal.factory.template.DefaultMailTemplateManager.getMailObjectsCount(DefaultMailTemplateManager.java:173) at org.xwiki.mail.internal.factory.template.DefaultMailTemplateManager.getObjectMailNumber(DefaultMailTemplateManager.java:144) at org.xwiki.mail.internal.factory.template.DefaultMailTemplateManager.evaluate(DefaultMailTemplateManager.java:94) at org.xwiki.mail.internal.factory.template.AbstractTemplateMimeMessageFactory.createMessage(AbstractTemplateMimeMessageFactory.java:93) at org.xwiki.mail.internal.factory.template.AbstractTemplateMimeMessageFactory.createMessage(AbstractTemplateMimeMessageFactory.java:45) at org.xwiki.mail.internal.factory.usersandgroups.UsersAndGroupsMimeMessageIterator.next(UsersAndGroupsMimeMessageIterator.java:93) at org.xwiki.mail.internal.factory.usersandgroups.UsersAndGroupsMimeMessageIterator.next(UsersAndGroupsMimeMessageIterator.java:43) at org.xwiki.mail.internal.thread.PrepareMailRunnable.prepareMail(PrepareMailRunnable.java:122) at org.xwiki.mail.internal.thread.PrepareMailRunnable.run(PrepareMailRunnable.java:78) at java.lang.Thread.run(Thread.java:748)
Attachments
Issue Links
- is duplicated by
-
XWIKI-12178 NullPointerException when trying to create a mail from a not existing mail template document
- Closed