[riscosweb] Email by Perl

  • From: Mark Syder <marksyder@xxxxxxxxxxxxxxxx>
  • To: riscosweb@xxxxxxxxxxxxx
  • Date: Fri, 27 Mar 2009 09:47:40 +0000

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
    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";


print "Done";

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

Other related posts: