?
Solved

CDO.Message.1 error '8004020d'

Posted on 2006-05-09
7
Medium Priority
?
7,996 Views
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?


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

%>
0
Comment
Question by:nprignano
  • 4
  • 2
7 Comments
 
LVL 12

Expert Comment

by:Preece
ID: 16639615
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
 
LVL 15

Author Comment

by:nprignano
ID: 16640032
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
 
LVL 2

Accepted Solution

by:
schalcraft earned 2000 total points
ID: 16641481
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 15

Author Comment

by:nprignano
ID: 16642330
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
 
LVL 15

Author Comment

by:nprignano
ID: 16642501
when I try with IE, I get the following:

Microsoft VBScript runtime error '800a01a8'

Object required: 'objCDOSYSCon'

/signup_mail.asp, line 34


0
 
LVL 2

Expert Comment

by:schalcraft
ID: 16644328
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
 
LVL 15

Author Comment

by:nprignano
ID: 16644390
exactly the case.  just missed a couple instances.  the forms are working fine now.  thanks again.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

840 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