[riscosweb] Email by Perl

Hi everybody.

Can anyone see anything wrong with the following program? It creates the web page to confirm that the perl program has loaded but I don't receive an email.

#!/usr/bin/perl -wT
BEGIN {
    my $homedir = ( getpwuid($>) )[7];
    my @user_include;
    foreach my $path (@INC) {
        if ( -d $homedir . '/perl' . $path ) {
            push @user_include, $homedir . '/perl' . $path;
        }
    }
    unshift @INC, @user_include;
}
use strict;
use CGI ':standard';

my $to = "mark\@onlinegenie.net";
my $from = "marksyder\@blueyonder.co.uk";
my $subject = 'Test email';
my $contents = param('comments');
my $sendmail = "/usr/lib/sendmail";

print "Content-type: text/html\n\n";
print "Perl program successfully opened \n";
print "You want to sent an email to $to \n";
print "The subject of your email is $subject\n\n";
print "Your message was $contents \n";
print "Your email address is $from \n";

open(MAIL, "|$sendmail -t") || Error ('open', 'mail program');

print MAIL "To: $to \nFrom: $from\n";
print MAIL "Subject: $subject\n";
print MAIL "$contents\n";

close(MAIL);

print "Done";

sub Error {
  print "The server can't $_[0] the $_[1]: $! \n";
  exit;
}
--
Mark Syder (like the drink but spelt different)
OnLineGenie Web Design and Hosting: http://www.onlinegenie.net


Other related posts: