CDO.Message.1 error '8004020d'

I have made a few simple CDO email forms with ASP, and have them running on a page we host on our servers.  Problem is the page displays fine because the code is after the HTML, but we are getting a code error at the bottom of the page when the server generates the page.  Can you see anything I did wrong?


Error:

CDO.Message.1 error '8004020d'

At least one of the From or Sender fields is required, and neither was found.

/signup.asp, line 308


(line 308:  objCDOSYSMail.Send )



ASP:

<%

'create variables to store user input
  Dim strFirstName, strLastName, strEmail, strText

'Dimension variables
  Dim objCDOSYSCon  

'set variables to the values of user input
   strEmail = Request.Form("Email")
   strFirstName = Request.Form("FirstName")
   strLastName = Request.Form("LastName")
   strAddress = Request.Form("Address")
   strPhone = Request.Form("Phone")
   strCompany = Request.Form("Company")
   strTitle = Request.Form("Title")
   strLit = Request.Form("Literature")
   strSales = Request.Form("Salesperson")
   strTech = Request.Form("TechSupport")
   strText = "I am requesting additional infomation:  " & strLit & strTech & strSales & vbCrLf & vbCrLf &_
    "Name:  " & strFirstName & strLastName & vbCrLf & vbCrLf &_
    "Title:  " & strTitle & vbCrLf & vbCrLf &_
    "Company:  " & strCompany & vbCrLf & vbCrLf &_
    "Address:  " & strAddress & vbCrLf & vbCrLf &_
    "Phone:  " & strPhone & vbCrLf & vbCrLf &_
    "Email:  " & strEmail & vbCrLf


'Create the e-mail server object
  Set objCDOSYSMail = Server.CreateObject("CDO.Message")
  Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Out going SMTP server
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "webserver.mydomain.com"
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
  Set objCDOSYSMail.Configuration = objCDOSYSCon
  objCDOSYSMail.From = strEmail
  objCDOSYSMail.To = "info@mydomain.com"  
  objCDOSYSMail.Subject = "Info Request"
  objCDOSYSMail.TextBody = strText

  objCDOSYSMail.Send

'Close the server mail object
  Set objCDOSYSMail = Nothing
  Set objCDOSYSCon = Nothing

'Redirect the user to a cofirmation page  
  Response.Redirect("http://www.mydomain.com/confirmation.asp")

%>
LVL 15
nprignanoTechnical ArchitectAsked:
Who is Participating?
 
schalcraftConnect With a Mentor Commented:
I do it slightly differently. I dont create a separate configuration object. It would look like this;

 Dim objCDOSYSMail
 Set objCDOSYSMail = CreateObject("CDO.Message")

'Out going SMTP server
  objCDOSYSMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "webserver.mydomain.com"
  objCDOSYSMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  objCDOSYSMail.Configuration.Fields.Update

'Update the CDOSYS Configuration
  objCDOSYSMail.From = strEmail
  objCDOSYSMail.To = "info@mydomain.com"  
  objCDOSYSMail.Subject = "Info Request"
  objCDOSYSMail.TextBody = strText

  objCDOSYSMail.Send
0
 
PreeceCommented:
Is the Request.Form("Email") returning anything?  

After this line of code:
    strEmail = Request.Form("Email")
do a
   response.write "<br><br>Request.Form('Email'):  " & Request.Form("Email") & "<br><br>"

Preece
0
 
nprignanoTechnical ArchitectAuthor Commented:
Well, this was happening whe the page was loaded, not when the form was submitted.  I had the code on the same page as the html that was posting the results.  As a test, I have removed the code and placed it on a seperate asp file.  I will let you know what happens, but this is what I am anticipating:

the page with the form will display and function fine,

the form will submit the results to the form handler,

the form handler will fail and the email will not be sent.

but i will let you know.


thanks for the insight.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
nprignanoTechnical ArchitectAuthor Commented:
ok, now i get the following when submitting the form:

error '8004020f'

there are no other details than the error occurred on line 39 of the form handler:

objCDOSYSMail.Send


any ideas?
0
 
nprignanoTechnical ArchitectAuthor Commented:
when I try with IE, I get the following:

Microsoft VBScript runtime error '800a01a8'

Object required: 'objCDOSYSCon'

/signup_mail.asp, line 34


0
 
schalcraftCommented:
This link may help with the '8004020f' error

http://www.aspfaq.com/show.asp?id=2305

The second error looks like your referencing an object thats not defined (objCDOSYSCon) . Did you change the code and forget to comment something out?
0
 
nprignanoTechnical ArchitectAuthor Commented:
exactly the case.  just missed a couple instances.  the forms are working fine now.  thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.