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("SMTPsvg.Mailer"
;
$Mailer->{'FromName'} = $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = "Comment from Feedback Page";
$Mailer->{'BodyText'} = "Company / Institution: " . $Request->Form('Company')->item . "\n" .
"Telephone Number: " . $Request->Form('Telephone')->item . "\n" .
"Sender IP Address: " . $Request->ServerVariables('REMOTE_ADDR')->item . "\n\n\n" .
$Request->Form('Comments')->item;
if (! $Request->Form('Name')->item || ! $Request->Form('Email')->item || ! $Request->Form('Comments')->item) {
$Response->write("<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>"
;
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
$Response->write("<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>"
;
} else {
$Response->write('<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href="mailto: name2@company.com">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("SMTPsvg.Mailer"
;
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 "$Response" is not imported. Global symbol "$Response" 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("SMTPsvg.Mailer"
;
$Mailer->{'FromName'} = my $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = "Comment from PWD Feedback Page";
$Mailer->{'BodyText'} = "Company / Institution: " . $Request->Form('Company')->item . "\n" .
"Telephone Number: " . $Request->Form('Telephone')->item . "\n" .
"Sender IP Address: " . $Request->ServerVariables('REMOTE_ADDR')->item . "\n\n\n" .
$Request->Form('Comments')->item;
if (! $Request->Form('Name')->item || ! $Request->Form('Email')->item || ! $Request->Form('Comments')->item) {
my $Response->write("<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>"
;
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
my $Response->write("<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>"
;
} else {
my $Response->write("<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href="mailto: name2@company.com">Try clicking here to invoke your local mail program
to E-mail name2@company.com </a></FONT>"
;
}
}
%>
[sig][/sig]
} 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("SMTPsvg.Mailer"
$Mailer->{'FromName'} = $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = "Comment from Feedback Page";
$Mailer->{'BodyText'} = "Company / Institution: " . $Request->Form('Company')->item . "\n" .
"Telephone Number: " . $Request->Form('Telephone')->item . "\n" .
"Sender IP Address: " . $Request->ServerVariables('REMOTE_ADDR')->item . "\n\n\n" .
$Request->Form('Comments')->item;
if (! $Request->Form('Name')->item || ! $Request->Form('Email')->item || ! $Request->Form('Comments')->item) {
$Response->write("<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>"
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
$Response->write("<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>"
} else {
$Response->write('<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href="mailto: name2@company.com">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("SMTPsvg.Mailer"
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 "$Response" is not imported. Global symbol "$Response" 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("SMTPsvg.Mailer"
$Mailer->{'FromName'} = my $Request->Form('Name')->item;
$Mailer->{'FromAddress'} = $Request->Form('Email')->item;
$Mailer->{'RemoteHost'} = $MAILHOST;
$Mailer->{'Subject'} = "Comment from PWD Feedback Page";
$Mailer->{'BodyText'} = "Company / Institution: " . $Request->Form('Company')->item . "\n" .
"Telephone Number: " . $Request->Form('Telephone')->item . "\n" .
"Sender IP Address: " . $Request->ServerVariables('REMOTE_ADDR')->item . "\n\n\n" .
$Request->Form('Comments')->item;
if (! $Request->Form('Name')->item || ! $Request->Form('Email')->item || ! $Request->Form('Comments')->item) {
my $Response->write("<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>"
} else {
$Mailer->AddRecipient('' , 'name1@company.com' ) ;
$Mailer->AddRecipient('' , 'name2@company.com' ) ;
$Mailer->AddRecipient('' , 'name3@company.com) ;
if ($Mailer->SendMail()) {
my $Response->write("<P><FONT Size=+1>Thank you for your comments. They have been successfully sent.</FONT>"
} else {
my $Response->write("<P><FONT Size=+1>An Error has occurred. Your comments have not been successfully sent.<BR>
<a href="mailto: name2@company.com">Try clicking here to invoke your local mail program
to E-mail name2@company.com </a></FONT>"
}
}
%>
[sig][/sig]