How to email all space admins?

23-Oct-13

Good afternoon,
We're running Confluence v5.0.3. How can a Confluence administrator send a mass email to all the space administrators?

Thanks in advance for your time and consideration!

2 answers

1 accepted

This widget could not be displayed.

It is not possible AFAIK. See an open future request: https://jira.atlassian.com/browse/CONF-23935

This widget could not be displayed.

I created a two-step process to do this. First, there's a user macro that generates a list of all space admin's usernames, and then an XML/RPC script (running on my laptop outside the wiki) that gets and prints all the emails.

Here's the macro:

## Macro title: Space Administrators
## Macro has a body: Y or N (N)
## Body processing: Selected body processing option
## Output: Selected output option
##
## Based on code developed by: Andrew Frayling
## Date created: 28/04/2012
## Modified by Jonathan Simonoff 8/28/2012
## Macro to list all users and groups with the permission to administer any space
## @param 0:title=Email only|type=boolean
#set($helper=$action.getHelper())
#if($param0)
#foreach ($space in $spaceManager.getAllSpaces())
#if($space.isGlobal())
#foreach ($permission in $space.getPermissions())
#if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ($userName=$permission.getUserName())
##$helper.renderConfluenceMacro("{user-info:user=$userName|display=email}")<br/>
$userName 
#end
#end
#end
#end
#else
<table class="confluenceTable">
#foreach ($space in $spaceManager.getAllSpaces())
 #if($space.isGlobal())
   #set($spacekey=$space.getKey())
<tr>
        <td class="confluenceTd">$helper.renderConfluenceMacro("[$spacekey:]")</td>
<td class="confluenceTd">$spacekey</td><td class="confluenceTd">
  #foreach ($permission in $space.getPermissions())
    #if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ($userName=$permission.getUserName())
##$helper.renderConfluenceMacro("{user-info:user=$userName|display=email}") 
$userName
<br/>
 #end
  #end
 </tr>
 
  #end
#end
</table>
#end

 

Here's the script to get the email addresses from the usernames the macro generates. This assumes the macro has been put on a page called "Space Administrators" in a space with the key "space":

 

#!/usr/bin/python
  2 #
  3 import sys
  4 from xmlrpclib import Server
  5 s=Server("your-base-addr/rpc/xmlrpc")
  6 token=s.confluence2.login("adminuser","password")
  7 # Get the space admins page
  8 page=s.confluence2.getPage(token,"space","Space Administrators")
  9 spaceadmins=s.confluence2.renderContent(
 10   token,"wiki", page["id"],"",{"style":"clean"})
 11 # Get their emails
 12 adminlist=spaceadmins.splitlines()
 13 adminlist=sorted(set(adminlist)) #remove duplicates (and sort)
 14 for admin in adminlist:
 15   if "<" in admin: continue
 16   if admin:
 17     try:
 18       user=s.confluence2.getUser(token,admin) # Skips blanks
 19       print user["email"]
 20     except:
 21       continue

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

176 views 18 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you