Send Mail Using CDONTS Instead of dcomd and bypass Outlook

  • Thread starter Thread starter michael c
  • Start date Start date
M

michael c

Hi. I had a program looping through code and sending
emails fine until I upgraded to Outlook 2003 and now I'm
dealing with the security patch issue. I installed a
reference to Microsoft CDO for NTS 1.2 Library in Access.

Based on some reading, I was hoping to use the SMTP
Service to send mail directly. I'm not sure if the SMTP
service is running on my machine (if you know how I can
find out, that'd be great) and I have internet access on a
coroporate network running NT 2000. My OS is 2000 and my
Office Suite is 2003.

I'm hoping that sending it using the code below would work
and that I'd be able to bypass Outlook, but I'm getting
hung up on an error that says "Compile error. Invalid use
of property" in the .From statement. Does that mean I need
to add a reference to a library? Any suggestions would be
a huge help! Thanks!!!


Option Compare Database

Dim oNewMail As New CDONTS.NewMail

Private Sub SendMail()

oNewMail.From "(e-mail address removed)"
oNewMail.To "(e-mail address removed)"
oNewMail.BodyFormat = CdoBodyFormatText
oNewMail.Body = "Test"
oNewMail.Importance = CdoHigh
oNewMail.AttachFile "C:\Test.xls"
oNewMail.Send

End Sub
 
"Compile error. Invalid use
of property" in the .From statement. Does that mean I need
to add a reference to a library? Any suggestions would be
a huge help! Thanks!!!

Shouldn't the From and To be populated this way?


oNewMail.From = "(e-mail address removed)"
oNewMail.To = "(e-mail address removed)"

-- Dev
 
Wow! I can't believe I missed that! Thanks to your catch,
it gets as far as oNewMail.Send and then I get the
following error:

Runtime error 429: ActiveX component can't create object
 
Dev, You don't happen to know why I'm getting this error
on oNewMail.Send do you? Thanks for the help.

Runtime error 429: ActiveX component can't create object
 
Back
Top