diff --git a/README.md b/README.md
index ff8d6612ade002c68b9c80a7438c301ca6893b02..ad1189eaec56098bed33a5359fdb469303896944 100644
--- a/README.md
+++ b/README.md
@@ -87,3 +87,59 @@ Response:
 
 ## Example script to sync members of a Nextcloud group to a Mailman mailing list
 
+```
+#!/bin/bash
+
+if [ "$#" -lt 2 ]; then
+	echo "Simple script to sync all members of a nextcloud group to a mailman list. Usage: "
+	echo "./sync-nextcloud-group-mailman.sh [NEXTCLOUD_GROUP] [MAILMAN_LIST] [nosync]"
+fi
+
+group=$1
+list=$2
+[ "$3" == "nosync" ] && sync=0 || sync=1
+
+dir=$(dirname $0)
+
+server=[YOUR_NEXTCLOUD_SERVER_WITH_PATH]
+user=[ADMINUSER_READONLY]
+pass=[ADMINPASSWORD_READONLY]
+url="https://$user:$pass@$server/ocs/v1.php/"
+
+
+
+echo "GROUP $group (Mailinglist $list)"
+echo "====================="
+
+# Spaces in NextCloud groups need to be escaped as %20
+users=$(curl -s -X GET "${url}cloud/groups/${group/ /%20}" -H "OCS-APIRequest: true" | xpath -q -e '/ocs/data/users/element/text()')
+
+mails=""
+for u in $users; do
+	name=$(curl -s -X GET "${url}cloud/users/$u" -H "OCS-APIRequest: true" | xpath -q -e "/ocs/data/displayname/text()")
+	response=$(curl -s -X GET "${url}apps/secondarymail/getAddress/$u" -H "OCS-APIRequest: true")
+	failure=$(echo $response | xpath -q -e "/ocs/meta/status/text()")
+	
+	if [ "$failure" != "ok" ]; then
+		echo "Unable to query NextCloud for user preferences on email and for secondary mail. Is the secondarymail app enabled?"
+		echo "Server response:"
+		echo -e $response
+		exit 1
+	fi
+	
+	mailaddresses=$(echo $response | xpath -q -e "/ocs/data/email/element/text()")
+	for e in $mailaddresses; do
+		if [ ! -z "$e" ]; then
+			mails="$mails$name <$e>\n"
+		fi
+	done
+done
+
+sync_flags="-a=no -g=no -w=no -d=no"
+if [ $sync = 0 ]; then
+	sync_flags="$sync_flags -n "
+fi
+
+printf "$mails" | sync_members $sync_flags -n -f - $list | grep -v -e 'Was-Wäre-Wenn-Modus' -e 'Ignoriere:' -e 'Nichts zu tun.'
+echo
+```