Hi,
can no get the script work, get 500 'Internal Server Error'
The question is what and where need be corrected to make script work? (question is not is this code designed good or bad. Just make script to work.)
#!/usr/bin/perl -w
$mailprog = '/usr/lib/sendmail';
$mail = 'recipient-email@adress.com';
$from = 'sender-email@address.com';
$file = 'report.txt';
$col = 2;
if (($ENV{QUERY_STRING} eq "new") && (-e $file)){unlink($file);}
open (DATA, $file);
$num = ;
close (DATA);
if ($num eq "") {$num = 0;}
for ($i = 1; $i<=$col; $i++){$n = $i + $num;
open (MAIL, "|$mailprog -t");
print MAIL "Content-Type: text/plain; charset = windows - 1251\n";
print MAIL "Subject: Text, Text!\n";
print MAIL "To: $mail\n";
print MAIL "From: $from\n\n";
print MAIL "Hello, the message text itself..\n";
print MAIL "\n\n";
close (MAIL);
}
open (DATA, ">$file");
print DATA $num+$col;
close (DATA);
print "Content-type: text/html\n\n";
print "$num\n";
print " \n";
2006-04-06 Retitled by planetscape, as per Monastery guidelines
Original title: 'where need be corrected to make script work?'
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.