summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-email
blob: 400dc2ac7cfd3076d178a1c6e9d19ce652451ae9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/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 @svc_acct = qsearch('svc_acct', {});
my @emails = map $_->email, @svc_acct;

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.2 2002-09-18 22:50:44 ivan Exp $

=head1 BUGS

=head1 SEE ALSO

=cut