`<handler>` takes <SPOOL>/incoming/G<queue>.<id>:
- Renames to <SPOOL>/incoming/P<queue>.<id>.
- Processes incoming mail.
- - Archives or deletes.
+ - Unlinks.
$c{ListAddress} = "emesinae-test\@list.example.com";
$c{ListAliases} = qw/emesinae-test\@list.example.org/;
-$c{SpoolDir} = "/var/local/emesinae/spool/";
+$c{SpoolDir} = "/var/local/emesinae/spool/";
+$c{ArchiveIncoming} = 0;
+
$c{LockDir} = "/var/local/emesinae/locks/";
$c{ReportingURL} = "http://bugs.example.com/Howto_Report_Bugs.html";
# XXX send the mail
$reply->print( \*STDOUT );
+
+unlink("incoming/P$m");
$msg->writeraw( \@hdrs, \*M );
close(M);
+
+unlink("incoming/P$m");
my $prefix = 'I';
rename( "T.$id", "$prefix$queue.$id" ) || &failure("rename spool message: $!");
+if ( $c{ArchiveIncoming} ) {
+ my $archive = sprintf( "$c{SpoolDir}/%04d-%02d/", $year + 1900, $mon + 1 );
+ eval {
+ if ( !-d $archive )
+ {
+ mkdir($archive) || die "Unable to make archive dir $archive: $!";
+ }
+ link( "$prefix$queue.$id", "$archive/$queue.$id" )
+ || die "Unable to create archive link: $!";
+ };
+ if ($@) {
+ chomp($@);
+ print STDERR "$@";
+ print STDERR "Continuing";
+ }
+}
+
exit(0);
sub failure {