×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
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("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>' );
        }
    }

%>
    
….

</body>
</html>





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

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

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

(OP)
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 "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("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>' );
        }
    }

%>
    
?

</body>
</html>

REPLY BY THOMAS:


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


REPORTED ERROR:



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

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

(OP)
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 "$Response" is not imported. Global symbol "$Response" 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("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>");
        }
    }

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

(OP)
Help! Can't call method "AddRecipient" 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 "$Response" is not imported. Global symbol "$Response" 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("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>");
}
}

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close