Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-11769

Allow sending mail to a list of groups + list of users + list of emails

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 6.4.2, 7.0-milestone-2
    • 6.4
    • Mail
    • None
    • Unit, Integration
    • Unknown

    Description

      Need:

      • Ability to send a mail to a list of users in several groups
      • Ability to also mention a discrete list of users to send to
      • Ability to specify a discrete list of emails to sent to
      • Ability to also exclude some users, some users and some emails
      • Duplicate mails should not be sent to the same user

      Note: Need to make sure we handle subgroups

      Scripting API proposal:

      {{velocity}}
      ## Parameters for the 'template' MimeMessageFactory
      #set ($templateParameters = {'language' : $xcontext.language, 'velocityVariables' : { 'var1' : 'value1' }})
      
      #set ($templateReference = $services.model.createDocumentReference('', 'Space', 'MailTemplatePage'))
      #set ($parameters = {'hint' : 'template', 'parameters' : $templateParameters, 'source' : $templateReference})
      
      #set ($groupReference = $services.model.createDocumentReference('', 'XWiki', 'MyGroup'))
      #set ($user1Reference = $services.model.createDocumentReference('', 'XWiki', 'User1'))
      #set ($user2Reference = $services.model.createDocumentReference('', 'XWiki', 'User2'))
      
      #set ($source = {'groups' : [$groupReference], 'users' : [$user1Reference, $user2Reference], 'emails' : ['john@doe.com'], 'excludedUsers' : [], 'excludedEmails' : [], 'excludedGroups' : []})
      
      #set ($messages = $services.mailsender.createMessages('usersandgroups', $source, $parameters))
      #set ($mailResult = $services.mailsender.send($messages, 'database'))
      {{/velocity}}
      

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: