AlternC/src/mail_del

28 lines
472 B
Perl
Executable File

#!/usr/bin/perl
use strict;
my ($mailname) = @ARGV;
if (!$mailname) {
print "Usage: mail_del <mailname>\n";
print " Destroy pop account <mailname>\n";
exit(1);
}
$ENV{PATH} = "";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (!($mailname =~ /^([a-z0-9_\+-][a-z0-9_\+\.-]+\_[a-z0-9\.-]+)$/)) {
die "Email is incorrect.";
}
$mailname=$1;
$< = $>;
$( = $);
system("/bin/rm -rf '/var/alternc/mail/".substr($mailname,0,1)."/".$mailname."'");
0;