For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2006 > Perl Script Code Help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Perl Script Code Help
r.rain@btinternet.com

2006-07-26, 6:57 pm

Hello

I have the following perl script that I downloaded from a website:

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
print "Content-type: text/html \n\n";

# Website Contact Form Generator
# http://www.tele-pro.co.uk/scripts/contact_form/
# This script is free to use as long as you
# retain the credit link

# get posted data into local variables
$input = new CGI;
$EmailFrom = "ContractIT";
$EmailTo = "richard.rainbow\@reedelsevier.com";
$Subject = "Testing email";
$Name = $input->param('Name');
$Address = $input->param('Address');
$Street1 = $input->param('Street1');
$City = $input->param('City');

# validation
$validationOK=true;
if ($validationOK eq false) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

# prepare email body text
$Body .= "Name: ";
$Body .= "$Name";
$Body .= "\n";
$Body .= "Address: ";
$Body .= "$Address";
$Body .= "\n";
$Body .= "Street1: ";
$Body .= "$Street1";
$Body .= "\n";
$Body .= "City: ";
$Body .= "$City";
$Body .= "\n";

# send email
use Win32::OLE;
$ex = Win32::OLE->new('CDONTS.NewMail') or die "\nCDONTS error";
$ex-> Send($EmailFrom,$EmailTo,$Subject,$Body)
;

# redirect to success page
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";

When the script runs on my Windows XP machine I get a CDONT error as
follows:

C:\cgi-bin>contact.pl
Content-type: text/html

Content-type: text/html

<H1>Software error:</H1>
<PRE>
CDONTS error at C:\cgi-bin\contact.pl line 44.
</PRE>
<P>
For help, please send mail to this site's webmaster, giving this error
message
and the time and date of the error.

[Wed Jul 26 15:48:59 2006] C:\cgi-bin\contact.pl:
[Wed Jul 26 15:48:59 2006] C:\cgi-bin\contact.pl: CDONTS error at
C:\cgi-bin\con
tact.pl line 44.

C:\cgi-bin>

I am using a contact form on a webpage that is providing the
information for this script.

Could someone be so kind to let me know what is going wrong hereand how
I can fix it?

I have no web development or scripting experience, i just want to get a
quick contact form working on my website created with sitecraft.

TIA

Richard

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com