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!

Can't call method "AddRecipient" on unblessed reference.

Status
Not open for further replies.

huareu

Programmer
Sep 29, 2000
5
0
0
US
I got the following error message:


} else { $Mailer->AddRecipient('' , 'name1@company.com' ) ; error '80004005'

Can't call method "AddRecipient" on unblessed reference.

/feedback.asp, line 35

***********************************************
during the execution of this file: Can you help? Thanks.
Hu

************************************
<%@ LANGUAGE = PerlScript%>

<html>
…..

<%

$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>' );
}
}

%>

….

</body>
</html>





[sig][/sig]
 
Are you shure that
Code:
$Mailer = $Server->CreateObject(&quot;SMTPsvg.Mailer&quot;);
creates an Object? You should check this. With
Code:
$Win32::OLE::Warn = 3;
every COM error is immediately reported and your script dies.
Hope that helps
Thomas
[sig][/sig]
 
Thanks for the reply, I inserted the $Win32::OLE::Warn=3; as suggested, and the reported error listed on the bottom. I'm a beginner in PERL, so can you help me with this type of syntax error? Thanks.
Hu


THE ORIGINAL CODE:


I got the following error message:


} else { $Mailer->AddRecipient('' , 'name1@company.com' ) ; error '80004005'

Can't call method &quot;AddRecipient&quot; on unblessed reference.

/feedback.asp, line 35

***********************************************
during the execution of this file: Can you help? Thanks.
Hu

************************************
<%@ LANGUAGE = PerlScript%>

<html>
?.

<%

$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>' );
}
}

%>

?

</body>
</html>

REPLY BY THOMAS:


Are you shure 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
Thomas


REPORTED ERROR:



$Win32::OLE::Warn=3; $Mailer->{'FromName'} = $Request->Form('Name')->item; error '80004005'
Variable &quot;$Mailer&quot; is not imported. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 6. Variable &quot;$Request&quot; is not imported at (eval 10) line 6. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 6. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 7. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 7. Variable &quot;$Request&quot; is not imported at (eval 10) line 7. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 7. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 8. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 8. Variable &quot;$MAILHOST&quot; is not imported at (eval 10) line 8. Global symbol &quot;$MAILHOST&quot; requires explicit package name at (eval 10) line 8. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 9. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 9. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 10. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 10. Variable &quot;$Request&quot; is not imported at (eval 10) line 10. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 10. Variable &quot;$Request&quot; is not imported at (eval 10) line 11. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 11. Variable &quot;$Request&quot; is not imported at (eval 10) line 12. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 12. Variable &quot;$Request&quot; is not imported at (eval 10) line 13. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 13. Variable &quot;$Request&quot; is not imported at (eval 10) line 14. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 14. Variable &quot;$Request&quot; is not imported at (eval 10) line 14. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 14. Variable &quot;$Request&quot; is not imported at (eval 10) line 14. Global symbol &quot;$Request&quot; requires explicit package name at (eval 10) line 14. Variable &quot;$Response&quot; is not imported at (eval 10) line 15. Global symbol &quot;$Response&quot; requires explicit package name at (eval 10) line 15. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 17. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 17. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 18. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 18. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 19. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 19. Variable &quot;$Mailer&quot; is not imported at (eval 10) line 20. Global symbol &quot;$Mailer&quot; requires explicit package name at (eval 10) line 20. Variable &quot;$Response&quot; is not imported at (eval 10) line 21. Global symbol &quot;$Response&quot; requires explicit package name at (eval 10) line 21. Variable &quot;$Response&quot; is not imported at (eval 10) line 23. Global symbol &quot;$Response&quot; requires explicit package name at (eval 10) line 23. Variable &quot;$Response&quot; is not imported at (eval 10) line 28. Global symbol &quot;$Response&quot; requires explicit package name at (eval 10) line 28.
[sig][/sig]
 
UPDATE OF LAST POST on 10/12/00


I got the following reported error after executing the code on the bottom.


} $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 52




<%@ LANGUAGE = PerlScript%>
<html>
<head>
<title>Feedback Page</title>
</head>

<BODY>
<TABLE>
</TABLE>

<%
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]
 
Help! Can't call method &quot;AddRecipient&quot; on unblessed reference.

I got the following reported error after executing the code on the bottom. Please help. Thanks.
Hu


} $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 52



<%@ LANGUAGE = PerlScript%>
<html>
<head>
<title>Feedback Page</title>
</head>

<BODY>
<TABLE>
</TABLE>

<%
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