Error 8004020f when using CDOSYS

Discussion in 'ASP General' started by Larry D, Jul 14, 2007.

  1. Larry D

    Larry D Guest

    I have a client with a site that users can register at, we collect their
    emails, if they have one, in an Access db. I have a page that uses CDOSYS to
    send messages to those emails but I am getting "error '8004020f" when I do
    this. About 75% of the members have emails so some email fields in the db
    are empty. One issue with my webhost is that I cannot send by CDOSYS more
    than 99 emails at a time, so I select all emails where the ID is less than
    97, that is about 85 emails total. After the first group goes out the page
    redirects to another page so the next group can go out.

    Here is how I select the emails: rs.open "select MemberEmail from membership
    where MemberEmail <> '""' AND ID <= 97",aqe,3,3

    As a test I copied the member database, replaced all the member email
    addresses with 3 different email addresses that I have and the form works
    fine. I get a copy of the message for every member who I gave one of my
    email addresses to. However, when I use the members real addresses I get the
    '8004020f' error. I found a place on the web that said that error means,
    among other things, an invalid email address. I have looked at the db and
    there were a couple bad addresses. One person had .net instead of .com for
    their ISP and one person was at abc@gmail. They had left off the .com part,
    I fixed those but it still hangs.

    It looks to me like the SMTP server is somehow validating the emails before
    sending them off, and if the email is not valid it crashes instead of just
    skipping over it. When I use my 3 good email addresses it works fine but not
    with the member's addresses. Any ideas on how to fix this?
     
    Larry D, Jul 14, 2007
    #1
    1. Advertising

  2. Larry D

    Larry D Guest

    New discovery. I set up a page just to write out all the email addresses one
    per line to see what I would get using this statement:

    sqlstr = "select MemberEmail, ID from Membership where MemberEmail <> '""'
    AND ID <= 115 order by ID"

    I am getting some gaps in my lines. Apparently there are some non-empty
    fields with just a space in them. CDOSYS treats that like a bad address and
    posts the error message I get. using the <>'""' I avoid fields that are
    truly empty but not ones where the member might put a space in then decides
    against putting in his email address. How do I test for that?

    Larry

    "Larry D" <> wrote in message
    news:...
    >I have a client with a site that users can register at, we collect their
    >emails, if they have one, in an Access db. I have a page that uses CDOSYS
    >to send messages to those emails but I am getting "error '8004020f" when I
    >do this. About 75% of the members have emails so some email fields in the
    >db are empty. One issue with my webhost is that I cannot send by CDOSYS
    >more than 99 emails at a time, so I select all emails where the ID is less
    >than 97, that is about 85 emails total. After the first group goes out the
    >page redirects to another page so the next group can go out.
    >
    > Here is how I select the emails: rs.open "select MemberEmail from
    > membership where MemberEmail <> '""' AND ID <= 97",aqe,3,3
    >
    > As a test I copied the member database, replaced all the member email
    > addresses with 3 different email addresses that I have and the form works
    > fine. I get a copy of the message for every member who I gave one of my
    > email addresses to. However, when I use the members real addresses I get
    > the '8004020f' error. I found a place on the web that said that error
    > means, among other things, an invalid email address. I have looked at the
    > db and there were a couple bad addresses. One person had .net instead of
    > .com for their ISP and one person was at abc@gmail. They had left off the
    > .com part, I fixed those but it still hangs.
    >
    > It looks to me like the SMTP server is somehow validating the emails
    > before sending them off, and if the email is not valid it crashes instead
    > of just skipping over it. When I use my 3 good email addresses it works
    > fine but not with the member's addresses. Any ideas on how to fix this?
    >
     
    Larry D, Jul 15, 2007
    #2
    1. Advertising

  3. Larry D

    Larry D Guest

    I finally found a fix by doing it this way:

    select MemberEmail AS email from membership where ((ID <= 115) AND
    (MemberEmail <> '""') AND (len(MemberEmail) > 5))"

    which fixed the problem of spaces in the email address field and no real
    text,. I then do

    objMail.To = email

    instead of

    objMail.To = trim(request.form("MemberEmail"))

    Seems to work now.


    "Larry D" <> wrote in message
    news:%...
    > New discovery. I set up a page just to write out all the email addresses
    > one per line to see what I would get using this statement:
    >
    > sqlstr = "select MemberEmail, ID from Membership where MemberEmail <> '""'
    > AND ID <= 115 order by ID"
    >
    > I am getting some gaps in my lines. Apparently there are some non-empty
    > fields with just a space in them. CDOSYS treats that like a bad address
    > and posts the error message I get. using the <>'""' I avoid fields that
    > are truly empty but not ones where the member might put a space in then
    > decides against putting in his email address. How do I test for that?
    >
    > Larry
    >
    > "Larry D" <> wrote in message
    > news:...
    >>I have a client with a site that users can register at, we collect their
    >>emails, if they have one, in an Access db. I have a page that uses CDOSYS
    >>to send messages to those emails but I am getting "error '8004020f" when I
    >>do this. About 75% of the members have emails so some email fields in the
    >>db are empty. One issue with my webhost is that I cannot send by CDOSYS
    >>more than 99 emails at a time, so I select all emails where the ID is less
    >>than 97, that is about 85 emails total. After the first group goes out the
    >>page redirects to another page so the next group can go out.
    >>
    >> Here is how I select the emails: rs.open "select MemberEmail from
    >> membership where MemberEmail <> '""' AND ID <= 97",aqe,3,3
    >>
    >> As a test I copied the member database, replaced all the member email
    >> addresses with 3 different email addresses that I have and the form works
    >> fine. I get a copy of the message for every member who I gave one of my
    >> email addresses to. However, when I use the members real addresses I get
    >> the '8004020f' error. I found a place on the web that said that error
    >> means, among other things, an invalid email address. I have looked at the
    >> db and there were a couple bad addresses. One person had .net instead of
    >> .com for their ISP and one person was at abc@gmail. They had left off the
    >> .com part, I fixed those but it still hangs.
    >>
    >> It looks to me like the SMTP server is somehow validating the emails
    >> before sending them off, and if the email is not valid it crashes instead
    >> of just skipping over it. When I use my 3 good email addresses it works
    >> fine but not with the member's addresses. Any ideas on how to fix this?
    >>

    >
    >
     
    Larry D, Jul 16, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alex

    CDO error 8004020f

    alex, Oct 3, 2003, in forum: ASP General
    Replies:
    4
    Views:
    197
  2. vvv

    just error 8004020f

    vvv, Nov 5, 2003, in forum: ASP General
    Replies:
    1
    Views:
    153
    Aaron Bertrand - MVP
    Nov 5, 2003
  3. Paco
    Replies:
    4
    Views:
    433
    Jeff Cochran
    Mar 30, 2005
  4. Owen
    Replies:
    6
    Views:
    387
    Yan-Hong Huang[MSFT]
    Feb 20, 2004
  5. Luis

    8004020F error with CDO.Message

    Luis , Jul 27, 2004, in forum: ASP General
    Replies:
    1
    Views:
    361
    Rob Collyer
    Jul 27, 2004
Loading...

Share This Page