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 All

I have some perl script that I downloaded from a website so I could use
it with my contact form on my website. The code is as follows:

#!/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 = "test";
$EmailTo = "anyone@anywhere.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 I get it I get a CDONTs error as below:

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>

Can anyone please help me out with this.I am just trying to add a
contact form to my website.

TIA

Richard

Sponsored Links







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

Copyright 2008 codecomments.com