Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendmail Error

Status
Not open for further replies.

MaxGeek

Technical User
Jan 8, 2004
52
0
0
US
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.
 
Hi :)

Have a look at the FAQ on sending mail using sendmail, that should sort you out.

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
your variable $to is not initialized to anything, also @test....add the pragma <use strict;> to your code to hint you about these things.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top