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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable "$.." is not imported. Global symbol "$.." requir

Status
Not open for further replies.

huareu

Programmer
Sep 29, 2000
5
0
0
US
The original error message occurred after submiting Feedback.htm,

} else { $Mailer->AddRecipient('' , 'name1@company.com' ) ; error '80004005'
Can't call method "AddRecipient" on unblessed reference.
/feedback.asp, line 35


The original file as follow:

<%@ LANGUAGE = PerlScript%>
<html>
<body>
<table>
¡K..
</table>

<%
$MAILHOST = company.com'; ## SMTP server for email page.
$Mailer = $Server->CreateObject(&quot;SMTPsvg.Mailer&quot;);

$Mailer->{'FromName'} = $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = &quot;Comment from Feedback Page&quot;;
$Mailer->{'BodyText'} = &quot;Company / Institution: &quot; . $Request->Form('Company')->item . &quot;\n&quot; .
&quot;Telephone Number: &quot; . $Request->Form('Telephone')->item . &quot;\n&quot; .
&quot;Sender IP Address: &quot; . $Request->ServerVariables('REMOTE_ADDR')->item . &quot;\n\n\n&quot; .
$Request->Form('Comments')->item;

if (! $Request->Form('Name')->item || ! $Request->Form('Email')->item || ! $Request->Form('Comments')->item) {
$Response->write(&quot;<BR>Error! You must fill in the Name, Email, and Comments fields. Press the back button on your browser to return to the form.<BR>&quot;);
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
$Response->write(&quot;<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>&quot;);
} else {
$Response->write('<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href=&quot;mailto: name2@company.com&quot;>Try clicking here to invoke your local mail program
to E-mail name2@company.com</a></FONT>' );
}
}
%>

¡K.
</body>
</html>



The first reply I got is this:

¡§Are you sure that
$Mailer = $Server->CreateObject(&quot;SMTPsvg.Mailer&quot;);
creates an Object? You should check this. With
$Win32::OLE::Warn = 3;
every COM error is immediately reported and your script dies.
Hope that helps¡¨



Then I inserted use strict and my before variables, and got a new error message.


} $Response->writeblock(1); error '80004005'
Variable &quot;$Response&quot; is not imported. Global symbol &quot;$Response&quot; requires explicit package name at (eval 10) line 28.
/feedback.asp, line 45
Can you help? Thank you.


The revised file:

<%
use strict;
$Win32::OLE::Warn=3;
my $MAILHOST = ¡¥company.com'; ## SMTP server for email page.
my $Mailer = my $Server->CreateObject(&quot;SMTPsvg.Mailer&quot;);
$Mailer->{'FromName'} = my $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = &quot;Comment from PWD Feedback Page&quot;;
$Mailer->{'BodyText'} = &quot;Company / Institution: &quot; . $Request->Form('Company')->item . &quot;\n&quot; .
&quot;Telephone Number: &quot; . $Request->Form('Telephone')->item . &quot;\n&quot; .
&quot;Sender IP Address: &quot; . $Request->ServerVariables('REMOTE_ADDR')->item . &quot;\n\n\n&quot; .
$Request->Form('Comments')->item;

if (! $Request->Form('Name')->item || ! $Request->Form('Email')->item || ! $Request->Form('Comments')->item) {
my $Response->write(&quot;<BR>Error! You must fill in the Name, Email, and Comments fields. Press the back button on your browser to return to the form.<BR>&quot;);
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
my $Response->write(&quot;<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>&quot;);
} else {
my $Response->write(&quot;<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href=&quot;mailto: name2@company.com&quot;>Try clicking here to invoke your local mail program
to E-mail name2@company.com </a></FONT>&quot;);
}
}
%>


[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top