This writes the file OK. I don't know why I'm doing this for $transaction->recipients if there's only one recipient per hook, other than to get $_ for the $_->address to work.
for ( $transaction->recipients ) { $transaction->header->add( 'Delivered-To' , $_->address , 0 ) ; my ( $time , $microseconds ) = gettimeofday ; $time = ( $time =~ m/(\d+)/ )[0] ; $microseconds =~ s/\D//g ; my $unique = "P$$" . "M$microseconds" . "Q" . $MAILDIR_COUNTER++ ; my $file = join "." , $time , $unique , "honeypot" ; my $maildir = $QPHOME . "/var/honeypot" ; # mkpath's earlier open ( MF , '>' , $maildir . '/tmp/' . $file ) or die ( DECLINED , "queue error (open) $!" ) ; $transaction->header->print( \*MF ) or die ( DECLINED , "queue header print $!" ) ; $transaction->body_resetpos ; while ( my $line = $transaction->body_getline ) { print MF $line ; } close MF ; link $maildir . '/tmp/' . $file , $maildir . '/new/' . $file ; unlink ( $maildir . '/tmp/' . $file ) ; }
qmail-queue uses fault() instead of die(). I don't see fault() in the desktop reference or in POSIX, which qmail-queue uses(but it's fault() rather than POSIX::fault() in qm-q anyway).
-Bob Dodds