Error 8004020f when using CDOSYS

L

Larry D

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?
 
L

Larry D

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
 
L

Larry D

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top