Help me please!

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

I'm trying to write a guestbook type script.
The script will execute, but it doesn't send the mail or write to the file i want it to.
Here is what I have so far:

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
$name = $formdata{'name'};
$email = $formdata{'email'};
$icq = $formdata{'icq'};
$time = $formdata{'times'};
open(PRO, ">> /data1/hypermart.net/e-ngl/test2/pro.txt");
print PRO "$name \n";
print PRO "$email \n";
print PRO "$icq \n";
print PRO "$time \n";
close(PRO);
$to = "parrabal\@home.com";
open(MAIL, "|/var/qmail/bin/qmail-inject-T");
print MAIL "To: $to \n";
print MAIL "From: $email \n";
print MAIL "Subject: NGL Profiles \n";
print MAIL "$name \n";
print MAIL "$email \n";
print MAIL "$icq \n";
print MAIL "$time \n";
close(MAIL);
'

thanks

Laughing out loud

They have: 62 posts

Joined: May 2000

I think you need to separate the "-T" from the sendmail path with a space.

With the printing of the file, are you sure you have the right path? Also, is the file chmodded for writing?

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

That didn't work.
It executes fine, but won't actually send the form info.
I have all the variables correct but it still doesn't work.
Please advise
Thanks

Laughing out loud

They have: 161 posts

Joined: Dec 1999

You keep using the %formdata hash:

$name = $formdata{'name'};
'

Where did you fill this hash? (Answer: you didn't.)

I suggest you use the CGI.pm module (which is standard with Perl ever since version 5.002):

#!/usr/bin/perl
use CGI;
$query = CGI->new;
$name = $query->param('name');
$email = $query->param('email');
$icq = $query->param('icq');
$time = $query->param('time');
# rest of program here...
'

They have: 62 posts

Joined: May 2000

Heheh, sorry for overlooking that NGM, it makes sense now. I'm getting weak. Smiling

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.