Help needed using "CDONTS.NewMail" in Perl scripts (with Win32::OLE)? 
Author Message
 Help needed using "CDONTS.NewMail" in Perl scripts (with Win32::OLE)?

Hi all,
I've been trying to use the COM component CDONTS.NewMail in my Perl CGI
script but keep getting errors. Below is a code snippet of mine. I performed
2 tests which both raise the error
Win32::OLE(0.1101) error 0x80070005: "Access is denied" in
METHOD/PROPERTYGET "Send"
whenever the send() method is called.
In the second test, after assigning values to properties, reading those
properties returns empty values -- weird.

I hope somebody can help.
Batormaster666
P.S. reply only to newsgroup.

use Win32::OLE;
print "Content-Type: text/html\n\n<html><body>\n";


my $subj = 'CDONTS test';
my $body = 'test';
my $srvr = 'localhost';
print "CDONTS.NewMail object test 1:<br>\n";
if ($obj = Win32::OLE->new('CDONTS.NewMail')) {
 $obj->Send($from,$to,$subj,$body,0);
 if (Win32::OLE->LastError) {
  print 'Error sending: ' . Win32::OLE->LastError . "<br><br><br>\n";
 }
 else {
  print "Email sent.<br><br><br>\n";
 }
 undef($obj);

Quote:
}

else {
 print "CDONTS does not work!<br><br><br>\n";

Quote:
}

print "CDONTS.NewMail object test 2:<br>\n";
if ($obj = Win32::OLE->new('CDONTS.NewMail')) {
 $obj->{'From'} = $from;
 $obj->{'To'} = $to;
 $obj->{'Subject'} = $subj;
 $obj->{'Body'} = $body;
 print 'From: ' . $obj->{'From'} . "<br>\n";
 print 'To: ' . $obj->{'To'} . "<br>\n";
 print 'Subject: ' . $obj->{'Subject'} . "<br>\n";
 print 'Body: ' . $obj->{'Body'} . "<br>\n";
 $obj->Send();
 if (Win32::OLE->LastError) {
  print 'Error sending: ' . Win32::OLE->LastError . "<br><br><br>\n";
 }
 else {
  print "Email sent.<br><br><br>\n";
 }
 undef($obj);
Quote:
}

else {
 print "CDONTS does not work!<br><br><br>\n";
Quote:
}



Tue, 02 Mar 2004 07:49:18 GMT  
 Help needed using "CDONTS.NewMail" in Perl scripts (with Win32::OLE)?


Quote:
>I've been trying to use the COM component CDONTS.NewMail in my Perl CGI
>script but keep getting errors.

[...]

Why don't you use MIME::Lite and Net::SMTP instead? They're much
easier to use and your code will be portable. I'd also wager some
money that your web server will be more stable if you refrain from
using stuff like OLE.

Just my $0.02 of course.
--

split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while



Tue, 02 Mar 2004 09:35:12 GMT  
 Help needed using "CDONTS.NewMail" in Perl scripts (with Win32::OLE)?
Perhaps the current user doesn't have access to the mailroot\drop directory?
CDONTS will also carp if the email addresses you feed it are not in the
format it expects.

Beyond that, unless you really need the multipart formatting provided by
this object, it's probably better not to use it in the face of
equally-straightforward SMTP packages.

--Steve


Quote:
> Hi all,
> I've been trying to use the COM component CDONTS.NewMail in my Perl CGI
> script but keep getting errors. Below is a code snippet of mine. I
performed
> 2 tests which both raise the error
> Win32::OLE(0.1101) error 0x80070005: "Access is denied" in
> METHOD/PROPERTYGET "Send"

[snip]


Wed, 03 Mar 2004 01:58:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. OLE referencing problem: PerlScript, ASP and CDONTS.NewMail object

2. Win32::OLE - "No such interface supported"

3. Need help using MS CDONTS from perlscript

4. using a perl script to open a word document using WIN32::OLE

5. HELP: Need help with "pattern matching"

6. Account "Management" Perl Script Need

7. using unix "at" from perl script

8. Need perl "cookbook" scripts

9. need help "cross-building"perl 5.8.0

10. Perl "Newbie" Needs Help Debugging Code

11. Is it possible to use CDONTS.NewMail with Win32::OLE?

12. "Parse exceptions" using WIN32::ODBC

 

 
Powered by phpBB® Forum Software