<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[iRedMail — Get list of all users/emails, for every domain]]></title>
		<link>http://www.iredmail.org/forum/topic4318-get-list-of-all-usersemails-for-every-domain.html</link>
		<atom:link href="http://www.iredmail.org/forum/feed-rss-topic4318.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Get list of all users/emails, for every domain.]]></description>
		<lastBuildDate>Wed, 02 Jan 2013 11:10:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Get list of all users/emails, for every domain]]></title>
			<link>http://www.iredmail.org/forum/post19722.html#p19722</link>
			<description><![CDATA[<p>Thank you but I dont have any knowledge of working with ldap so the &quot;ldapsearch&quot; hasn&#039;t helped. </p><p>I was able to simplify one of your examples so this 90% achieves what I need. </p><p>Although I find this is also listing the domain names. </p><div class="codebox"><pre><code>#!/usr/bin/env python
# encoding: utf-8

import sys
import ldap

# Note:
#   * bind_dn must have write privilege on LDAP server.
uri = &#039;ldap://127.0.0.1:389&#039;
basedn = &#039;o=domains,dc=example,dc=com&#039;
bind_dn = &#039;cn=Manager,dc=example,dc=com&#039;
bind_pw = &#039;pass&#039;

# Initialize LDAP connection.
conn = ldap.initialize(uri=uri, trace_level=0,)
conn.bind_s(bind_dn, bind_pw)

# Get all mail users.
allUsers = conn.search_s(
        basedn,
        ldap.SCOPE_SUBTREE,
        &quot;(objectClass=mailUser)&quot;,
        [&#039;mail&#039;],
        )

# Print all email users separated by comma
for user in allUsers:
    (dn, entry) = user
    mail = entry[&#039;mail&#039;][0]
    
    if len(mail) &gt; 0:    
        print &gt;&gt; sys.stdout, &quot;%s, &quot; %(mail)

# Unbind connection.
conn.unbind()</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (web2works)]]></author>
			<pubDate>Wed, 02 Jan 2013 11:10:56 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post19722.html#p19722</guid>
		</item>
		<item>
			<title><![CDATA[Re: Get list of all users/emails, for every domain]]></title>
			<link>http://www.iredmail.org/forum/post19706.html#p19706</link>
			<description><![CDATA[<p>You can get all mail users/lists with command &quot;ldapsearch&quot;. <img src="http://www.iredmail.org/forum/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (ZhangHuangbin)]]></author>
			<pubDate>Tue, 01 Jan 2013 03:23:31 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post19706.html#p19706</guid>
		</item>
		<item>
			<title><![CDATA[Get list of all users/emails, for every domain]]></title>
			<link>http://www.iredmail.org/forum/post19705.html#p19705</link>
			<description><![CDATA[<p>Is it possible to run a quick scripts which gets a list of all the email addresses for every domain? </p><p>I want to send out a mass email using bcc letting all the users know of any changes, so ideally this list would be separated by comma. </p><p>==== Required information ====<br />- iRedMail version: 0.8.3 LDAP<br />====</p>]]></description>
			<author><![CDATA[null@example.com (web2works)]]></author>
			<pubDate>Mon, 31 Dec 2012 14:13:55 +0000</pubDate>
			<guid>http://www.iredmail.org/forum/post19705.html#p19705</guid>
		</item>
	</channel>
</rss>
