diff options
| author | ivan <ivan> | 2001-05-15 07:52:34 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2001-05-15 07:52:34 +0000 | 
| commit | f41a78f519bfeb6ecd4e9cee271c42d2c27e717f (patch) | |
| tree | 2da3c086e40626d21ad733710d1e4ec120e94984 | |
| parent | 365fdd1f1938f399113a5ce013a7c2daa431a5c2 (diff) | |
simple program to list all email addresses
| -rwxr-xr-x | FS/bin/freeside-email | 61 | 
1 files changed, 61 insertions, 0 deletions
diff --git a/FS/bin/freeside-email b/FS/bin/freeside-email new file mode 100755 index 000000000..c7ff41114 --- /dev/null +++ b/FS/bin/freeside-email @@ -0,0 +1,61 @@ +#!/usr/bin/perl -Tw + +use strict; +use FS::UID qw(adminsuidsetup); +use FS::Conf; +use FS::Record qw(qsearch); +use FS::svc_acct; + +&untaint_argv;	#what it sounds like  (eww) +my $user = shift or die &usage; + +adminsuidsetup $user; + +my $conf = new FS::Conf; +my $domain = $conf->config('domain'); + +my @svc_acct = qsearch('svc_acct', {}); +my @usernames = map $_->username, @svc_acct; +my @emails = map "$_\@$domain", @usernames; + +print join("\n", @emails), "\n"; + +# subroutines + +sub untaint_argv { +  foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV +    #$ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\""; +    # Date::Parse +    $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\""; +    $ARGV[$_]=$1; +  } +} + +sub usage { +  die "Usage:\n\n  freeside-email user\n"; +} + +=head1 NAME + +freeside-email - Prints email addresses of all users on STDOUT + +=head1 SYNOPSIS + +  freeside-email user + +=head1 DESCRIPTION + +Prints the email addresses of all customers on STDOUT, separated by newlines. + +user: From the mapsecrets file - see config.html from the base documentation + +=head1 VERSION + +$Id: freeside-email,v 1.1 2001-05-15 07:52:34 ivan Exp $ + +=head1 BUGS + +=head1 SEE ALSO + +=cut +  | 
