Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm running an informix product called Web datablade that lets you do a whole mess of DB stuff from an web front end. This is supposed to grab some input from a webpage:
<?MIVAR NAME=SRVC>cd <perlrlcodedirectory> ;/usr/bin/perl ./smtpmail.p +l<?/MIVAR> <?MIEXEC SERVICE=$SRVC REQUEST=RAWPERL>"'The following Registration Ha +s Just Been Submitted By $one:\n\n Name:$one\n Job Title:$two\n Representing:$three\n Mailing Address:$four\n Email Address:$five\n City:$six\n Postal Code:$seven\n Phone Number(s) - Business:$eight\n Phone Number(s) - Home:$nine\n First Name:$ten\n \n Will Attend The SAM As: $eleven\n \n Will Go To The Following Events On Thursday:\n 1. $twelve\n 2. $thirteen\n 3. $fourteen\n 4. $fifteen\n \n Will Go To The Following Events On Friday:\n 1. $sixteen\n 2. $seventeen\n 3. $eighteen\n 4. $nineteen\n \n Method Of Payment:$twenty\n Debit Number:$twenty_one\n Authorization:$twenty_two\n \n \n \n ','dhaguma@cucbc.com'"<?/MIEXEC>
the stuff in <?MIVAR NAME=SRVC> and <?MIEXEC SERVICE=$SRVC REQUEST=RAWPERL> is the informix proprietary method of doing things and my script (smtpmail.pl) looks like this:
#!/usr/bin/perl require 5.002; BEGIN {$ENV{PATH} = '/usr/ucb:/bin'}; #Specify Modules use Socket; use Carp; use FileHandle; use English; $text = @ARGV[0]; $address = @ARGV[1]; $syscmd = "echo $text | rmail"; print "$syscmd\n"; system ( $syscmd ); /^RAWPERL/ && do { $fileName = '/tmp/' . $port . '.tmp'; $execute .= "\n"; undef(%results);# $execute string may create results $fileHandle = &executeCommand($fileName, $attributes, $e +xecute); while ( <$fileHandle> ) { # # send back results $bodyResult .= $_; } close $fileHandle; last SWITCH; }; $bodyResult = " REQUEST \"$_\" is unkown";
But it always seems to crap out and the message is never sent. I get the following error message:
$ echo 55379 | rmail sendmail: Message has no valid recipients
Any ideas would be much thanked.

Replies are listed 'Best First'.
(jcwren) Re: Informix output mailed through Perl?
by jcwren (Prior) on Oct 06, 2000 at 21:48 UTC
    Well, you never use the contents of $address, so rmail doesn't know who you're trying to send to. Unless '55379' is supposed to be a valid user on your system, which you didn't indicate either way.

    Personally, I'd use Net::SMTP, or MIME::Lite, or one of the other Perl mail tools. rmail doesn't *seem* to be the correct tool for the job, although I can safely say I know nothing about rmail, other than reading the rather limited man page text.

    --Chris

    e-mail jcwren
RE: Informix output mailed through Perl?
by TStanley (Canon) on Oct 07, 2000 at 23:04 UTC
    A couple of months ago, I had asked some questions concerning MIME::Lite and Sendmail in general. The two nodes are here and here. Hope these are of some help.

    TStanley