Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

my first CGI form sumission ... it driving me crazy!

Status
Not open for further replies.

2cxc

Programmer
Aug 29, 2003
245
CA
I'm on a windows server and the CGI folder persmission were set correctly by the ISP (so they say..) Its a SMTP mail program on the server and i'm using these scripts:
Code:
use strict;
use Net::SMTP();
my ($to, $company, $name);
use CGI();
my $cgi = new CGI();

my $smtp = Net::SMTP->new('XX.56.129.2');
##### XX is actually a number

my ($company, $name, $phone, $email, $comments);
$company = $cgi->param('company');
$name = $cgi->param('name');
$phone = $cgi->param('phone');
$email = $cgi->param('email');
$comments = $cgi->param('comments');

$to = 'myEmail@company.com';

my $message =<<EOM;
To: $to
From: server<companyEmail\@FromAddress.com>
Subject: $name filled out your contact form

$company
$name
$phone :
$email
$comments

$name filled out your form with this contact info.
EOM
;
print $cgi->header();
print $cgi->start_html();

print &quot;<h3>sending mail to $to </h3>\n&quot;;
$smtp->mail('');
$smtp->to($to);
$smtp->data($message);
$smtp->datasend();
$smtp->dataend();
$smtp->quit();
exit;

this is my form:
Code:
<html><head></head><body>
<FORM ACTION=&quot;/cgi-bin/formmail.pl&quot; METHOD=&quot;POST&quot;><CENTER>
<FONT SIZE=&quot;-1&quot; FACE=&quot;Verdana&quot;><B>company </B><INPUT NAME=&quot;company&quot; TYPE=&quot;text&quot; SIZE=&quot;25&quot;><BR>
<b>name </b><INPUT NAME=&quot;name&quot; TYPE=&quot;text&quot; SIZE=&quot;25&quot;>  </FONT></CENTER>
  <p><font size=&quot;-1&quot; face=&quot;Verdana&quot;><b>phone </b><INPUT NAME=&quot;phone&quot; TYPE=&quot;text&quot; SIZE=&quot;25&quot;> 
  </font></p>
  <p><CENTER>
  </CENTER>
<FONT SIZE=&quot;-1&quot; FACE=&quot;Verdana&quot;><b>email </b><INPUT NAME=&quot;email&quot; TYPE=&quot;text&quot; SIZE=&quot;25&quot;> 
  </FONT></p>
  <p><CENTER>
  </CENTER>
<FONT SIZE=&quot;-1&quot; FACE=&quot;Verdana&quot;><b>comments </b><INPUT NAME=&quot;comments&quot; TYPE=&quot;text&quot; SIZE=&quot;25&quot;> &nbsp;
  </FONT><CENTER>
  </p>
<P><INPUT NAME=&quot;name&quot; TYPE=&quot;submit&quot; VALUE=&quot;Submit Question&quot;></CENTER></FORM>
</body></html>

What happen when i submit the form i get a visual confirmation from this line of the script:
print &quot;<h3>sending mail to $to </h3>\n&quot;;

I check my eamil, and wait to ceck it again and nothing shows up? Why do i not get an email to my email address in the script: myEmail@company.com

???
 
See my answer to your other post. Use the Debug=>1 flag in the constructor for the SMTP object.
 
Try this:

Add this line with the rest of your CGI calls:

use CGI qw(param);

I've never used SMTP but maybe this will give you some clues...

Put this line with the rest of your CGI calls:

use CGI (qw param);

Rather than using this:

$company = $cgi->param('company');
$name = $cgi->param('name');
$phone = $cgi->param('phone');
$email = $cgi->param('email');
$comments = $cgi->param('comments');

use this:

$company = param('company');
$name = param('name');
$phone = param('phone');
$email = param('email');
$comments = param('comments');

Good luck

There's always a better way. The fun is trying to find it!
 
that way is giving me error trying to pick up the first value pair in string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top