Skip to content

Instantly share code, notes, and snippets.

@dynax60
Created January 21, 2011 09:57
Show Gist options
  • Save dynax60/789489 to your computer and use it in GitHub Desktop.
Save dynax60/789489 to your computer and use it in GitHub Desktop.
Remove helper for Postfixadmin
#!/usr/bin/env perl
use strict;
use warnings;
my $mailhome = '/var/spool/postfix/virtual';
my $domain = shift or die;
my $username = shift or die;
die "Invalid domain: $domain\n" unless $domain =~ m/^[\w\.\-]+$/;
die "Invalid username: $username\n" unless $username =~ m/^[\w\.\@\_]+$/;
my $maildir = "$mailhome/$domain/$username";
-d $maildir ?
qx { /bin/rm -rf $maildir } :
die "No such maildir: $maildir\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment