+use Debbugs::Control qw(append_action_to_log);
+use Encode qw(encode_utf8);
+
+=head1 NAME
+
+process - Handle e-mails emails sent to bugs
+
+=head1 SYNOPSIS
+
+process nn
+
+ Options:
+ --debug, -d debugging level (Default 0)
+
+=head1 OPTIONS
+
+=over
+
+=item <--debug,-d>
+
+Debugging level (default 0)
+
+=back
+
+=cut
+
+use vars qw($DEBUG);
+
+my %options = (debug => 0,
+ help => 0,
+ man => 0,
+ );
+
+GetOptions(\%options,
+ 'debug|d+','help|h|?','man|m');
+
+pod2usage() if $options{help};
+pod2usage({verbose=>2}) if $options{man};
+
+
+$DEBUG=$options{debug};
+my $debugfh = IO::File->new('/dev/null','w') or
+ die "Unable to open /dev/null for writing; $!";
+if ($DEBUG > 0) {
+ $debugfh = \*STDERR;
+}
+
+# these are the valid bug addresses
+my %baddress = (B => 'submit',
+ M => 'maintonly',
+ Q => 'quiet',
+ F => 'forwarded',
+ D => 'done',
+ S => 'submitter',
+ L => 'list',
+ );
+my $valid_codeletters = join('',keys %baddress);
+
+
+chdir($config{spool_dir}) or die "Unable to chdir to spool ($config{spool_dir}): $!";