English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm trying to create a contact form so that customers can email me, using specific required info. I don't understand the concept of using a mail template. I created a form on my wesite, in which the info, including the customer's email address is to be entered and submitted. I set the method to post, and the action to "cgi-bin/mail.cgi".

Now my mail.cgi is just a template that has this in it:

$name
$email
$address
$dayphone
$nightphone
$subject

What am I doing wrong? How am I supposed to make reference to the Tripod mailer, and which file do I put it in?

I keep getting this error message everytime it tries to access mail.cgi that says "Your script produced this error:
Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl) at mail.cgi line 1.
BEGIN failed--compilation aborted at mail.cgi line 1."

If anyoner would be willing to take me through understanding this, I would be extremely greatful!

2006-07-28 05:38:21 · 1 answers · asked by Rockstar 6 in Computers & Internet Programming & Design

1 answers

So you listed the full contents of the template they provided?
They should have more instructions on their site somewhere, but the first line should be something like "#!/usr/bin/perl -t"
The -t is commonly used as a security measure when a cgi script is taking user input. Then there should be a line like "use TripodMail;" Then there should be some specific methods that you would use to get the information from your form and then send the email - information about these methods should be provided by Tripod.

Update:
Okay, I did some poking around on the Tripod site.
You will want to do something like this:
#!/usr/local/bin/perl -t
require TripodCGI;
require TripodMail;
my $CGI = new TripodCGI;
my $MAIL = new TripodMail;
my $name = $CGI->param('name'); #in place of 'name' match whatever you had that element named to in your form.
my $email = $CGI->param('email');
my $address = $CGI->param('address');
#and so on for the other values
my $mailTemplate = "path/mail_template.txt";
my %variables = (
'email' => $email,
'name' => $name,
'address' => $address,
#and so on for your other values
);
$MAIL->sendMail($mailTemplate, \%variables);

Then your template file needs to look something like this, the template is required by the way and the name of this file for this example would be mail_template.txt:
To: $email
From: you@yahoo.com
Subject: $subject

Name: $name
Address: $address
Daytime Phone: $phoneDay
Night Phone: $phoneNight

As far as the template, it looks like the "varaibles", $name for example, need to match the "key" of the variables hash. For example, if you had
%variables(
'setEmail' => $thatEmail,
);

Then in the template you would access the value in $thatEmail like this:
To: $setEmail
Not:
To: $thatEmail

Hope this helps a bit.

Update 2:
Reading your question more closely, I want to make sure to point out that your cgi file and the template are two seperate files. Your template will just be a text file.

2006-07-28 17:50:42 · answer #1 · answered by sterno73 3 · 1 0

fedest.com, questions and answers