Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic


by TAC (Initiate)
on Aug 10, 2001 at 16:43 UTC ( #103852=perlquestion: print w/replies, xml ) Need Help??

TAC has asked for the wisdom of the Perl Monks concerning the following question:


I am in search of Win32 Perl wisdom. I am trying to use CDONTS.NewMail and I am basically getting an empty reference back when I request the object using Win32::OLE. (When I dump the reference the only value is the "Version => 1.2".) I thought my box was hosed, but I just managed to use this dll in VB and ASP. Has anyone had any luck using this in an application?


Replies are listed 'Best First'.
Re: CDONTS.dll
by c-era (Curate) on Aug 10, 2001 at 18:23 UTC
    This code works for me, running perl 5.6.0 on an exchange server:
    use Win32::OLE; $cd = Win32::OLE->new("CDONTS.NewMail") || die $!; $cd->{From}="test\"; $cd->{To}="test\"; $cd->{Subject}="test"; $cd->{Body}="test"; $cd->Send; print Win32::OLE->LastError();
    if that doesn't work try this in VB and let me know if this works:
    Dim cp As Object Set cp = CreateObject("CDONTS.NewMail") With cp .To = "" .From = "" .Subject = "test" .Body = "test" .Send End With
    The above VB code forces VB to use the same OLE interface as Perl does.
      Bizarrely enough the perl snipet you sent me worked. I swear on a stack of Orielly books that I did exactly what you suggested last night and it didn't work. Oh well... However I spoke to our architect and he shunned CDONTS because you don't have control over the headers and footers. He suggested MIME::Lite as an alternative.

      Thanks for your help.
        There actually is a way to get control over the headers and footers, but it's not a pretty hack (plus I don't remember it off hand). Anyways, MIME::Lite is a better choice and is less system and software dependant.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://103852]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-05-28 06:46 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (98 votes). Check out past polls.