[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 702
  • Last Modified:

Sending e-mail with CDO

I'm having a little trouble with my code.

It gives me this error message:

ADODB.Fields error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/LABS/Lab8/example1.asp, line 8

Line 8 is this: .Item(cdoSendUsingMethod)=2

Can someone please help me?


This is my whole code:

<%
sch="http://schemas.microsoft.com/cdo/configuration/"
'set the CDO object
Set cdoConfig=CreateObject("CDO.Configuration")

'apply data to CDO properties, port number and server name
With cdoConfig.Fields
      .Item(cdoSendUsingMethod)=2
      .Item(cdoSMTPServer)= "smtphm.sympatico.ca"
      .Item(cdoSMTPAuthenticate)=1
      .Item(cdoSendUsername)="username"
      .Item(cdoSendPassword)="password"
      .update
End With

'begin the message section
Set cdoMessage=CreateObject("CDO.Message")

'add data to e-mail properties
With cdoMessage
      Set .Configuration=cdoConfig
      .From="runthatshit@hotchick.com"
      .To="sh00tar@yahoo.ca"
      .Subject="WANNA SEE SOMETHING....??"
      .TextBody="Haha.... Fooled You!!!"
      .AddAttachment "c:\test.txt"
      .Send
End With

'release objects and memory
Set cdoMessage=Nothing
Set cdoConfig=Nothing
%>
0
sh00tar
Asked:
sh00tar
  • 2
1 Solution
 
WillibobCommented:
I suspect that the problem is because you need to enclose the Item arguments in double quotes:

 .Item("cdoSendUsingMethod")=2

Have a look here (http://www.w3schools.com/asp/asp_send_email.asp) if that doesn't sort it.

Bill
0
 
WillibobCommented:
Actually the problem lies with the fact that you are using late binding 'CreateObject("CDO.Message")' and are then using CDO constants as Item arguments.

Use the method contained within the link I gave in my previous post. I've used this method successfully.

Bill
0
 
Cherukuri30Commented:
Guess Metadata is missing try adding the below code in your page

<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now