problem with CDO

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cas

    problem with CDO

    Hi,

    I try to send emails with CDO. Those emails are in an Access table.
    It works when i put a real emailaddress between quotes in line .To (e.g. .To
    = any@mail.nl )
    When i do like the code here below, i get the error:
    error '8004020f'
    /defect2.asp, line 55 (line containing the .Send)

    Any idea what's the problem and how to solve this?
    Thanks
    Cas

    <!--
    METADATA
    TYPE="typelib"
    UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    NAME="CDO for Windows 2000 Library"
    -->
    <%
    set objdc = Server.CreateOb ject("ADODB.Con nection")
    objdc.Open("pro vider=Microsoft .Jet.OLEDB.4.0; Data Source
    =d:\access\newr es.mdb")
    sql="select email from email "
    set rs=Server.Creat eObject("ADODB. recordset")
    rs.open sql, objdc, 3, 3
    Set cdoConfig = CreateObject("C DO.Configuratio n")
    With cdoConfig.Field s
    .Item(cdoSendUs ingMethod) = cdoSendUsingPor t
    .Item(cdoSMTPSe rver) = "mail.tiscali.b e"
    .Update
    End With
    Set cdoMessage = CreateObject("C DO.Message")

    for i=1 to rec
    email=rs.fields ("email").va lue
    With cdoMessage
    Set .Configuration = cdoConfig
    .From = "aaa@ISP.nl "
    .To = email
    .Subject = "test"
    .TextBody = "it works!"
    .Send
    End With
    rs.MoveNext
    next
    end if

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing



  • Aaron [SQL Server MVP]

    #2
    Re: problem with CDO



    --
    Please contact this domain's administrator as their DNS Made Easy services have expired.

    (Reverse address to reply.)





    "Cas" <fhffh@rt.sp> wrote in message
    news:ueZ$i5PcEH A.2504@TK2MSFTN GP12.phx.gbl...[color=blue]
    > Hi,
    >
    > I try to send emails with CDO. Those emails are in an Access table.
    > It works when i put a real emailaddress between quotes in line .To (e.g.
    > .To
    > = any@mail.nl )
    > When i do like the code here below, i get the error:
    > error '8004020f'
    > /defect2.asp, line 55 (line containing the .Send)
    >
    > Any idea what's the problem and how to solve this?
    > Thanks
    > Cas
    >
    > <!--
    > METADATA
    > TYPE="typelib"
    > UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
    > NAME="CDO for Windows 2000 Library"
    > -->
    > <%
    > set objdc = Server.CreateOb ject("ADODB.Con nection")
    > objdc.Open("pro vider=Microsoft .Jet.OLEDB.4.0; Data Source
    > =d:\access\newr es.mdb")
    > sql="select email from email "
    > set rs=Server.Creat eObject("ADODB. recordset")
    > rs.open sql, objdc, 3, 3
    > Set cdoConfig = CreateObject("C DO.Configuratio n")
    > With cdoConfig.Field s
    > .Item(cdoSendUs ingMethod) = cdoSendUsingPor t
    > .Item(cdoSMTPSe rver) = "mail.tiscali.b e"
    > .Update
    > End With
    > Set cdoMessage = CreateObject("C DO.Message")
    >
    > for i=1 to rec
    > email=rs.fields ("email").va lue
    > With cdoMessage
    > Set .Configuration = cdoConfig
    > .From = "aaa@ISP.nl "
    > .To = email
    > .Subject = "test"
    > .TextBody = "it works!"
    > .Send
    > End With
    > rs.MoveNext
    > next
    > end if
    >
    > Set cdoMessage = Nothing
    > Set cdoConfig = Nothing
    >
    >
    >[/color]


    Comment

    • Cas

      #3
      Re: problem with CDO

      thanks
      "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
      news:O8LlPOQcEH A.3148@TK2MSFTN GP10.phx.gbl...[color=blue]
      > http://www.aspfaq.com/2305
      >
      > --
      > http://www.aspfaq.com/
      > (Reverse address to reply.)
      >
      >
      >
      >
      >
      > "Cas" <fhffh@rt.sp> wrote in message
      > news:ueZ$i5PcEH A.2504@TK2MSFTN GP12.phx.gbl...[color=green]
      > > Hi,
      > >
      > > I try to send emails with CDO. Those emails are in an Access table.
      > > It works when i put a real emailaddress between quotes in line .To (e.g.
      > > .To
      > > = any@mail.nl )
      > > When i do like the code here below, i get the error:
      > > error '8004020f'
      > > /defect2.asp, line 55 (line containing the .Send)
      > >
      > > Any idea what's the problem and how to solve this?
      > > Thanks
      > > Cas
      > >
      > > <!--
      > > METADATA
      > > TYPE="typelib"
      > > UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
      > > NAME="CDO for Windows 2000 Library"
      > > -->
      > > <%
      > > set objdc = Server.CreateOb ject("ADODB.Con nection")
      > > objdc.Open("pro vider=Microsoft .Jet.OLEDB.4.0; Data Source
      > > =d:\access\newr es.mdb")
      > > sql="select email from email "
      > > set rs=Server.Creat eObject("ADODB. recordset")
      > > rs.open sql, objdc, 3, 3
      > > Set cdoConfig = CreateObject("C DO.Configuratio n")
      > > With cdoConfig.Field s
      > > .Item(cdoSendUs ingMethod) = cdoSendUsingPor t
      > > .Item(cdoSMTPSe rver) = "mail.tiscali.b e"
      > > .Update
      > > End With
      > > Set cdoMessage = CreateObject("C DO.Message")
      > >
      > > for i=1 to rec
      > > email=rs.fields ("email").va lue
      > > With cdoMessage
      > > Set .Configuration = cdoConfig
      > > .From = "aaa@ISP.nl "
      > > .To = email
      > > .Subject = "test"
      > > .TextBody = "it works!"
      > > .Send
      > > End With
      > > rs.MoveNext
      > > next
      > > end if
      > >
      > > Set cdoMessage = Nothing
      > > Set cdoConfig = Nothing
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...