John Rudd's ms2cgp and cgp2ms

Leland J. Steinke steinkel at PA.NET
Thu Dec 4 13:57:58 GMT 2003

NTIN Page Guy wrote:
> Hello NTIN,
> Strange, I posted this message hours ago and it just now appeared.
> John pointed out that my fix below breaks messages that addressed to
> multiple recipients.

for my early postfix integration hack, I solved the same problem with a
fork() and exec().

Here is the relevant code.  Since I did some minor header processing
earlier in the script, the headers were already available in a variable.
You will have to adapt to how ms2cgp does things.

   $cmd = "/usr/sbin/sendmail";

   open(DATFILE, "$outgoing_spool/df$id") || die("no such id as $id");

   $pid = open(INSERT, "|-");  #fork
   $SIG{ALRM} = sub { die "pipe broke" };

   if ($pid) { #parent
     print INSERT "$headers\n";
     while (<DATFILE>) {
       print INSERT;
     close INSERT || die "$cmd exited $?";
   } else { #child
     exec($cmd, '-f', $from, '--', @to) || die("cannot exec $cmd");
   close DATFILE;

I hope this helps.


More information about the MailScanner mailing list