CDO.Message.1 error '8004020d'

Posted on 2006-05-09
Last Modified: 2008-10-15
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?


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 )



'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("") = ""
  objCDOSYSCon.Fields("") = 25
  objCDOSYSCon.Fields("") = 2
  objCDOSYSCon.Fields("") = 60

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


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

'Redirect the user to a cofirmation page  

Question by:nprignano
    LVL 12

    Expert Comment

    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>"

    LVL 15

    Author Comment

    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.
    LVL 2

    Accepted Solution

    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("") = ""
      objCDOSYSMail.Configuration.Fields("") = 2

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

    LVL 15

    Author Comment

    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:


    any ideas?
    LVL 15

    Author Comment

    when I try with IE, I get the following:

    Microsoft VBScript runtime error '800a01a8'

    Object required: 'objCDOSYSCon'

    /signup_mail.asp, line 34

    LVL 2

    Expert Comment

    This link may help with the '8004020f' error

    The second error looks like your referencing an object thats not defined (objCDOSYSCon) . Did you change the code and forget to comment something out?
    LVL 15

    Author Comment

    exactly the case.  just missed a couple instances.  the forms are working fine now.  thanks again.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Issue with "less" style sheets 2 119
    How can I write .htaccess code to redirect 301 pages? 1 86
    ColdFusion Rereplace 3 50
    CSS HELP 6 60
    Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
    Shoutout to Emily Plummer ( for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now