Emailing something from a perl CGI script 
Author Message
 Emailing something from a perl CGI script

[My abject apologies if this shows up twice.  I originally
posted it from my work account, which seems to be off the
air usenet-wise, at least for outgoing posts.]

Howdy,

First, I've read the Programming FAQ (well not all of it), and it
appears there's a more efficient way (Q4.1) to do this -- but just
for grins could someone tell me what, specifically, I'm doing wrong
here before I make any changes?

I've got a pair of CGI scripts that 1) present the user with a
form to be filled out and 2) take the contents of that form and
send them to an email address (which in turn forwards them to a
pager).

The contents of the form get formatted into a single temporary
file such that whatever lives behind the email address (someone
else's code to which I am not privy) can send them on to the
pager.  The file includes the message and the pager number.

After taking care of all this collection and formatting, I do
the actual emailing as follows:

  $retval = 0xffff & system("mail $pager_address < $tempfile");

And then test $retval for errors as described on p. 230 of the
Camel Book (2nd Ed).

A previous version of the script actually used:

  $retval = 0xffff & system("cat $tempfile | mail $pager_address");

This has worked pretty well in the past, but lately I'm getting
(with both methods) very frequent, but not consistent, occurences of
failure -- specifically an exit status of 12 (the 'elsif ($retval >
0x80)' case from the Camel Book).  I haven't been able to winkle out
what '12' means from manpages and the like....

I've confirmed that the temporary file is getting written properly,
and that it's readable.  I've also confirmed that the pager address
hasn't changed or anything, by emailing the temporary file directly
to the pager address from the command line.  The only way I can make
this break is by using the CGI scripts.

System info: Netscape 4.04 under Solaris 2.6, perl ver. 5.003.

Anyway, thanks for any info or suggestions.  I can provide more info
or the complete scripts if needed.

--



Sun, 27 May 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Emailing something from a cgi script

2. === Calling http:// ....something /something.cgi within another script ===

3. Emailing from CGI's scripts on Win32

4. emailing with CGI???

5. Emailing from CGI's on Win32

6. emailing with CGI???

7. Emailing from a script

8. Perl scripts under NT, something not right here.

9. Something wrong in this perl script for sendmail ?????

10. How to Deal With Something.zoo and Something.gz

11. emailing files with perl

12. Emailing from PERL with attachments

 

 
Powered by phpBB® Forum Software