Hello All,
I periodically want to send updates or news about my wiki instance to all its users via email. What is the best way to do this in XWiki? Is there an App or do I need to use the API?
Thanks,
Ben
Hello All,
I periodically want to send updates or news about my wiki instance to all its users via email. What is the best way to do this in XWiki? Is there an App or do I need to use the API?
Thanks,
Ben
Too bad that the Flash Message App doesn’t support email since it’s exactly what you need I think: http://extensions.xwiki.org/xwiki/bin/view/Extension/Flash%20messages%20application
I guess you could submit a Pull Request for it
Otherwise yes, using the Mail Sender API is the way to go.
OK, thanks Vincent.
Getting involved with pull requests is a little beyond by capabilities I think. I’ll write a macro to email or members of a group.
Ben
For anyone who comes across this thread in future, I solved this problem very quickly by adjusting this code snippet to output a string of emails which I then simply paste into Outlook.
You can also add the following script to a page, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Mail%20Sender%20API#HExample4:SendaTemplateemailtoalistofUsersandGroups
{{velocity}}
#if ("$!request.confirm" == '1')
#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'))
Mails are being sent. Check the status in the [[Admin>>path:$xwiki.getURL('XWiki.XWikiPreferences', 'admin', 'editor=globaladmin§ion=emailStatus')]].
#else
To send email to all users, [[click here>>||queryString='confirm=1']]
#end
{{/velocity}}