Sending e-mail with CDO

Posted on 2006-04-19
Last Modified: 2008-03-04
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:

'set the CDO object
Set cdoConfig=CreateObject("CDO.Configuration")

'apply data to CDO properties, port number and server name
With cdoConfig.Fields
      .Item(cdoSMTPServer)= ""
End With

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

'add data to e-mail properties
With cdoMessage
      Set .Configuration=cdoConfig
      .Subject="WANNA SEE SOMETHING....??"
      .TextBody="Haha.... Fooled You!!!"
      .AddAttachment "c:\test.txt"
End With

'release objects and memory
Set cdoMessage=Nothing
Set cdoConfig=Nothing
Question by:sh00tar
    LVL 5

    Accepted Solution

    I suspect that the problem is because you need to enclose the Item arguments in double quotes:


    Have a look here ( if that doesn't sort it.

    LVL 5

    Expert Comment

    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.

    LVL 7

    Expert Comment

    Guess Metadata is missing try adding the below code in your page

    NAME="CDO for Windows 2000 Library"


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now