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

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.4
    • Fix Version/s: 6.4.2, 7.0-milestone-2
    • Component/s: Mail
    • Labels:
      None
    • Tests:
      Unit, Integration
    • Difficulty:
      Unknown
    • Similar issues:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: