1 |
dpavlin |
1.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 |
|
|
$|++; |
13 |
|
|
|
14 |
|
|
while(<STDIN>) { |
15 |
|
|
chomp; |
16 |
|
|
chomp; |
17 |
|
|
|
18 |
|
|
($login,$fullname,undef,$email) = split(/:/,$_); |
19 |
|
|
my $host=$email; |
20 |
|
|
$host=~s/^[^@]@*//g; |
21 |
|
|
|
22 |
|
|
if (defined $debug) { |
23 |
|
|
open(MAIL,">> /tmp/mailfoo") || die "$!"; |
24 |
|
|
} else { |
25 |
|
|
open(MAIL,"| /usr/lib/sendmail -t") || die "sendmail: $!"; |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
print MAIL "To: $fullname <$email>\n"; |
29 |
|
|
|
30 |
|
|
open(IN,"$in_mail") || die "in mail: $!"; |
31 |
|
|
while(<IN>) { |
32 |
|
|
chomp; |
33 |
|
|
chomp; |
34 |
|
|
s/##login##/$login/g; |
35 |
|
|
s/##url##/$url/g; |
36 |
|
|
s/##pop3host##/$host/g; |
37 |
|
|
print MAIL "$_\n"; |
38 |
|
|
} |
39 |
|
|
close(IN); |
40 |
|
|
close(MAIL); |
41 |
|
|
print "." if ($debug); |
42 |
|
|
} |
43 |
|
|
|