use strict;
use Win32::NetAdmin;
use Net::SMTP;
my $dc = "\\\\x";
my $from = 'x@x.com';
my @recip_list = ('x@x.com', 'y@y.com');
my $smtp_host = "x.x.x.x";
my @users = ();
my $VERSION = "1.2";
my $smtp = Net::SMTP->new($smtp_host, Timeout => 30) || die "Can't con
+nect to $smtp_host.\n";
$smtp->mail($from) || die "cannot mail from.\n\n";
$smtp->recipient(@recip_list);
$smtp->data();
$smtp->datasend("To:\tPerl Recipients\n");
$smtp->datasend("Subject:\tPerl output of Users in the domain\n\n");
Win32::NetAdmin::GetUsers($dc, undef, \@users) || die "GetUsers failed
+.\n";
foreach (@users) {
$smtp->datasend( "$_\n\n");
}
$smtp->dataend;
$smtp->quit;
=head1 NAME
adminmail - This script grabs a list of all the users in a domain and
+emails the results to an email address.
=head1 DESCRIPTION
This program is useful for quickly getting a list of all the users on
+your domain. I wrote this program when our Notes
administrator "Maddog" needed a list of users on the domain.
=head1 README
This script grabs a list of all the users in a domain and emails the r
+esults to an email address.
=head1 PREREQUISITES
This script has a few requirements. You will need the Win32::NetAdmin
+ and Net::SMTP modules.
You will also need to change the values for dc, from, recip_list, and
+smtp_host.
=head1 COREQUISITES
None
=pod OSNAMES
MSWin32
=pod SCRIPT CATEGORIES
Win32/Utilities
=cut
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|