> I'm pretty much used to scripting sendmail applications in > tcl - and I'm very new to perl so this may be a dumb > question. I'm working with a sendmail script that I got off > the internet. The script that I'm working with is listed below: > > #!/usr/bin/perl > use CGI; > > my $query = new CGI; > my $sendmail = "/usr/sbin/sendmail -i -t"; > my $reply_to = "Reply-to: geringer2\@cox.net"; > my $subject = "Subject: Confirmation of your submission"; > my $content = "Thanks for your submission."; > my $to = $query->param('send_to'); > my $file = "subscribers2.txt"; > > unless ($to) { > print $query->header; > print "Please fill in your email and try again"; > } > > open (FILE, ">>$file") or die "Cannnot open $file: $!"; > print $to,"\n"; > close(FILE); > > my $send_to = "To: ".$query->param('send_to'); > > 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."; ~ ~ > > -------------------------------------- > > The only difference between this and the one I found is the > "\" in fron of the "@". When I run this cript - the error > that I'm seeing is that the header is malformed.
If what you're trying to get help on is the malformed header error then this is probably the problem : You should need to do \@ if you're using double quotes, shouldn't need if you use single quotes. Did having that ( the \ in front of the @ ) cause the error? Could you be less ambiguous about the problem, is the problem the 'header malformed' error or you can't send mail or ...? What happens when you run it form the command line? You might want to look into a module, they're much easier to work with and portable. The one I started working wioth lately is : http://search.cpan.org/author/JENDA/Mail-Sender-0.8.04/Sender.pm Or search cpan and find one you like/does what you want and you'll probably on ly need a few lines of code to do what you want. Dan > > If anyone can tell me what I did wrong - I would appreciate it. > > What I'm trying to do is put a perl script on a server which > will take data from an html document and redirect it to an > email address. Once I get one to work, I'm confident that I > can make modifications and work with it (testing etc), to > better understand how perl makes it works. > > I would really appreciate any help I can get. > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]