[boulder.pm] Help printing to e-mail

Wayde Allen wallen at boulder.nist.gov
Mon Jan 24 17:23:52 CST 2000


OK, I'm stumped.  I've been trying to build a web based purchase
requisition system and everything is basically in place.  Unfortunately
I'm having difficulty creating a nicely formated e-mail.

I've been able to create a decent message using something like:

   format MAIL =
   From:  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          $sender
   To:    @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  
          $recipient
   Subject:  Request for Purchase Approval
   .

   open (MAIL, "|/usr/lib/sendmail -oi -t") or die "<P>Can't Fork Sendmail</P>: $!";
   write MAIL;

This works, but I need to create a variable length formated table, and
don't see how to do this with a static format.  

So, resorting to brute force I have tried creating the format on the fly. 
The idea is to create a row for each item being ordered.  The problem I'm
having is that now I'm getting an error saying "No recipient addresses
found in header".  The code looks like: 

   my $formated_txt = "format MAIL = \n"
   . "From: \@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n"
   .        $sender . "\n"
   . "To: \@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< \n"
   .      $recipient . "\n"
   . "Subject:  Request for Purchase Approval\n"
   . ".\n";

   eval $formated_txt;

   open (MAIL, "|/usr/lib/sendmail -oi -t") or die "<P>Can't Fork Sendmail</P>: $!";
   write MAIL;

Anyone see what I'm doing wrong, or have a better solution?
 
- Wayde
  (wallen at boulder.nist.gov)





More information about the Boulder-pm mailing list