why won't my mailling list work?
Ok, I get the email sent to me when I run the script but it has no subject or message.
#!/usr/bin/perl
##############################################################
$mail_prog = '/usr/sbin/sendmail';
$yourname = "Dot Comper";
$youremail = "dot\@dotcomper.co.uk";
$goodpass = "pass";
##############################################################
&parse_form;
##############################################################
$subject = $input{'subject'};
$message = $input{'message'};
##############################################################
&send_email;
##############################################################
print "Content-type: text/html\n\n";
print "send successful\n";
##############################################################
# THE SUBS
##############################################################
sub send_email {
open(LIST,"/WebSites/hosted/dotcomper.co.uk/cgi-bin/testscan/mememails.txt");
@addresses=<LIST>;
close(LIST);
foreach $line(@addresses) {
chomp($line);
open(MAIL, "|$mail_prog -t") || &error("Could not send out emails");
print MAIL "To: $line \n";
print MAIL "From: $yourname <$youremail>\n";
print MAIL "Subject: $subject \n";
print MAIL "$message";
print MAIL "\n\n";
print MAIL "\n\n";
close (MAIL);
}
}
################################################################
sub parse_form {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
################################################################
I run a html page 2 fields in it, one called message and one caled subject so the
$subject = $input{'subject'};
$message = $input{'message'};
shoukld work but it doesnt seem to.
Any help?
123finder.com posted this at 22:52 — 20th August 2000.
They have: 60 posts
Joined: Aug 2000
Should it be $FORM{'xxx'} instead of $input{''}
Since you called &parseform; & don't specify return value for it!
minton posted this at 14:49 — 21st August 2000.
They have: 314 posts
Joined: Nov 1999
you were right, it worls a treat now, thanks alot
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.