/[docman]/contrib/sendlogins.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /contrib/sendlogins.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Wed Jul 3 08:22:55 2002 UTC (16 years, 11 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +6 -0 lines
File MIME type: text/plain
display help

1 #!/usr/local/bin/perl -w
2
3 # usage: cat .htusers | sendlogins.pl http://docmain.domain.com/
4
5 #my $debug=1;
6
7 my $in_mail=$0;
8 $in_mail=~s/\.pl/.txt/;
9
10 my $url=$ARGV[0];
11
12 if (! $url) {
13 print STDERR "To send announcement to all users in .htusers file use\n";
14 print STDERR "$0 http://docman.site.com/ < .htusers\n";
15 exit 1;
16 }
17
18 $|++;
19
20 while(<STDIN>) {
21 chomp;
22 chomp;
23
24 ($login,$fullname,undef,$email) = split(/:/,$_);
25 my $host=$email;
26 $host=~s/^[^@]*@//g;
27
28 if (defined $debug) {
29 open(MAIL,">> /tmp/mailfoo") || die "$!";
30 } else {
31 open(MAIL,"| /usr/lib/sendmail -t") || die "sendmail: $!";
32 }
33
34 print MAIL "To: $fullname <$email>\n";
35
36 open(IN,"$in_mail") || die "in mail: $!";
37 while(<IN>) {
38 chomp;
39 chomp;
40 s/##login##/$login/g;
41 s/##url##/$url/g;
42 s/##pop3host##/$host/g;
43 print MAIL "$_\n";
44 }
45 close(IN);
46 close(MAIL);
47 print "." if ($debug);
48 }
49

  ViewVC Help
Powered by ViewVC 1.1.26