I'm trying to get a sendmail script to work, but when I run it I get a error message of:
"No recipient addresses found in header"
Heres the code I am using:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
use CGI;
my $query = new CGI;
my $sendmail = "/usr/sbin/sendmail -t";
my $reply_to = "test\@test.com";
my $subject = "Subject: Confirmation of your submission";
my $content = "Thanks for your submission.";
unless ($to) {
print $query->header;
print "Please fill in your email and try again";
}
#
#my $send_to = "To: ".$query->param('send_to');
my $send_to = "To: ". "test\@test";
open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);
print $query->header;
print "Confirmation of your submission will be emailed to you.";
----------------------------
Any help would be appreciated. Thanks.
"No recipient addresses found in header"
Heres the code I am using:
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
use CGI;
my $query = new CGI;
my $sendmail = "/usr/sbin/sendmail -t";
my $reply_to = "test\@test.com";
my $subject = "Subject: Confirmation of your submission";
my $content = "Thanks for your submission.";
unless ($to) {
print $query->header;
print "Please fill in your email and try again";
}
#
#my $send_to = "To: ".$query->param('send_to');
my $send_to = "To: ". "test\@test";
open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);
print $query->header;
print "Confirmation of your submission will be emailed to you.";
----------------------------
Any help would be appreciated. Thanks.