error '8004020f' ASP Programming help w/ SMTP

P

Paco

I'm having a problem with an ASP page I've made and was hoping someone
out there can help.

My page sends an email using CDO to a username pulled from a database
as follows:

With cdoMessage
Set .Configuration = cdoConfig
.From = "Admin <[email protected]>"
.To = rs("USERName") & "@MyCompany.com"
.Subject = "Notification #" & rs("subject_Num")
.TextBody = txtVar
.Send
End With

this works great so long as USERName isn't garbage. If there are bad
characters in it that IIS doesn't like, it get an error '8004020f' at
the .send line. I was wondering if there was an easy and / or
publicly available code snippet that could check the user name for
special chars. Ideally, it would email me if there was a problem with
the USERName rather than just strip the bad chars out and send it to
whatever is left.

Any help pointing me in the right direction would be greatly
appreciated.

Paco
 
A

Aaron Bertrand - MVP

this works great so long as USERName isn't garbage.

So don't allow usernames with garbage!?!??

Validate going on (keeping your data clean) or at least on the way out.

This will help with the whole address, which you should construct and
validate before even entering With cdoMessage...

http://www.aspfaq.com/2238
 
J

Jeff Cochran

I'm having a problem with an ASP page I've made and was hoping someone
out there can help.

My page sends an email using CDO to a username pulled from a database
as follows:

With cdoMessage
Set .Configuration = cdoConfig
.From = "Admin <[email protected]>"
.To = rs("USERName") & "@MyCompany.com"
.Subject = "Notification #" & rs("subject_Num")
.TextBody = txtVar
.Send
End With

this works great so long as USERName isn't garbage. If there are bad
characters in it that IIS doesn't like, it get an error '8004020f' at
the .send line. I was wondering if there was an easy and / or
publicly available code snippet that could check the user name for
special chars. Ideally, it would email me if there was a problem with
the USERName rather than just strip the bad chars out and send it to
whatever is left.

Any help pointing me in the right direction would be greatly
appreciated.

This is normal error checking and validation. It can be done client
side or server side (or both) but client side, while easy and fast,
can be spoofed by a knowledgeable user. For code snippets, search on
"validate email address format" and toss in "asp" or "javascript" and
you'll find plenty. Good starting points:

http://www.aspin.com/home/tutorial/email/validati?pg=2&order=desc
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=47

Jeff
 
J

Jeff Cochran

I am currently working on a Web site that is coming up with the same
error. I can send to anyone within my ISP's domain (cox.net), but if I
use a domain outside of the ISP's network for the recipient (gmail.com,
etc.), this is the error I get. Oddly enough, I can send *from* any
domain I want. I have tried sending from my GMail account, as well as
from a couple of other domains I have, and they all work fine. The
problem only appears when I send e-mail to someone who's e-mail address
is not on Cox Communications' mail server. I've got all sorts of
validation and such in the code, but it just doesn't seem to want to
work. Any other suggestions for things to look at? I'd greatly
appreciate it. Thank you for your time.

FAQ:

Why does CDO.Message give me 8004020F errors?
http://www.aspfaq.com/show.asp?id=2305

Jeff
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top