Getting Email List from Windows Domain

Pete Russell pete at ENITECH.COM.AU
Sun Feb 20 01:49:20 GMT 2005


    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Cool script. Note that there are 1 or 2 methods available in the MAQ.
(Lotus Notes one from me), and the original Exchange perl one i stole
from some one else (is credited on the webpage).

May i suggest that unless you add some comments to your code that it may
not be all that useful to others.

Is your for creating the access list for us in postfix? I create
recipient lists for postfix - do you know whether one has more benifits
than the other?

Thanks - make sure you put your new creation in the FAQ on
www.mailscanner.info
Pete


David C.M. Weber wrote:
> I know that this has been answered before, and I just wanted to share my
> YANWTSAC (yet another way to skin a cat).
>
> Like many other Mailscanner + Exchange users, my mailscanner box is both
> a SMTP & HTTP proxy.  I was having issues w/ the complexity of pushing
> out a generated list via SSH, so I made an ASP script, which my
> Mailscanner server can perform a WGET on, download, do some shenanigans,
> and create the access.db file from.
>
>>From here below is the script. I stole some ideas from other VBScripts,
> and if I could remember where the pieces came from, I'd give full
> credit.  Sorry :(.
>
> This should work on any domain.  Let me know if there are bugs/etc.
>
> I'm still ironing out my cron job, but this was a rather exciting fix
> for me, that I couldn't wait to share.
>
> ----------------------------------
> default.asp
> ----------------------------------
> <%
> Dim rootDSE, domainObject
> Set rootDSE=GetObject("LDAP://RootDSE")
> domainContainer = rootDSE.Get("defaultNamingContext")
> Set domainObject = GetObject("LDAP://" & domainContainer)
> Set fs = CreateObject ("Scripting.FileSystemObject")
> ExportUsers(domainObject)
> Set oDomain = Nothing
>
>
> Sub ExportUsers(oObject)
>         Dim oUser
>         For Each oUser in oObject
>                 Select Case oUser.Class
>                         Case "user"
>                                 If oUser.mail <> "" then
>
>                                         for each email in
> oUser.proxyAddresses
>                                                 print_email(email)
>                                         next
>                                 End if
>
>                         Case "group"
>                                 If oUser.mailNickname <> "" then
>
>                                         for each email in
> oUser.proxyAddresses
>                                                 print_email(email)
>                                         next
>                                 End if
>
>                         Case "organizationalUnit" , "container"
>                                 If UsersGroupsinOU (oUser) then
>                                         ExportUsers(oUser)
>                                 End if
>                 End select
>         Next
> End Sub
>
> Function print_email(email)
>         if Instr(email, "SMTP:") <> 0  or Instr(email, "smtp:") <> 0
> then
>                 dim n, e
>                 ' locate the ":"
>                 n = InStr(1, email, ":", 1)
>
>                 ' and chop it off
>                 e = Right(email, Len(email) - n)
>
>                 ' write the email address, two tabs, and a LF
>                 response.write(e & Chr(9) & Chr(9) & "ACCEPT" & Chr(10))
>
>         end if
> end function
>
> Function UsersGroupsinOU (oObject)
>         Dim oUser
>         UsersGroupsinOU = False
>         for Each oUser in oObject
>                 Select Case oUser.Class
>                         Case "organizationalUnit" , "container"
>                                 UsersGroupsinOU = UsersGroupsinOU(oUser)
>                         Case "user"
>                                 UsersGroupsinOU = True
>                         Case "group"
>                                 UsersGroupsinOU = True
>                 End select
>         Next
> End Function
>
> %>
>
> ------------------------ MailScanner list ------------------------
> To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
> 'leave mailscanner' in the body of the email.
> Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
> the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
>
> Support MailScanner development - buy the book off the website!
>
>
>

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!




More information about the MailScanner mailing list