Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am a newbie to asp and am trying to setup a form. When I send the form I get the following error:

CDO.Message.1 error '8004020d'

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

Here is my code:
HTML
<form id="form_1" action="process.asp" method="post">

   <div class="pad1">
     <h3>Request an Appraisal</h3>
     <input type="hidden" name="To" value="csaeed@gmail.com" />
      <input type="hidden" name="Subject" value="Request an Appraisal" />

     <div class="row"> <label for="fullname">Name:</label><br />
        <input type="text" class="input" name="Fullname">
     </div>
     <div class="row"> <label for="streetaddress">Address:</label><br />
       <input type="text" class="input" name="Streetaddress">
     </div>
     <div class="row"> <label for="custcity">City/State/Zip:</label><br />
       <input type="text" class="input" name="Custcity">
     </div>
     <div class="row"> <label for="custphone">Phone:</label><br />
       <input type="text" class="input" name="Custphone">
     </div>
     <div class="row"> <label for="custemail">Email:</label><br />
       <input type="text" class="input" name="Custemail">
     </div>
     <div class="cols pad_left1"> <input type="submit" class="button" value="Submit"></div>
   </div>
 </form>


My ASP looks like this:

VB
<%
Dim mail, body

body = "Name: " & Request.Form("fullname") & vbcrlf & "Address: " & Request.Form("streetaddress") & vbcrlf & "City/State/Zip: " & Request.Form("custcity") & vbcrlf & "Phone: " & Request.Form("custphone") 

Set objCDOConf = Server.CreateObject ("CDO.Configuration")
' ** SET AND UPDATE FIELDS PROPERTIES **
With objCDOConf
    ' ** OUT GOING SMTP SERVER **
    .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP_SERVER_HERE"
    ' ** SMTP PORT **
    .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    ' ** CDO PORT **
    .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    ' ** TIMEOUT **
    .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    .Fields.Update 
End With

Set objMail = Server.CreateObject("CDO.Message")

' ** UPDATE THE CDOSYS CONFIGURATION **
Set objMail.Configuration = objCDOConf

' ** Set mail = Server.CreateObject("CDO.Message") **
objMail.To = Request.Form("csaeed@gmail.com")
objMail.From = Request.Form("From")
objMail.Subject = Request.Form("Subject")
objMail.TextBody = Body
objMail.Send()

Response.Write("Thanks for submitting the feedback.")

Set objMail = nothing
Set body = nothing
Set objCDOConf = Nothing
%>
Posted
Updated 27-Jan-21 4:02am
v2

Member 10369098 wrote:
CDO.Message.1 error '8004020d'

At least one of the From or Sender fields is required, and neither was found.
The error message clearly telling you that you didn't pass value for From/Sender fields. And I have checked your code & found that you didn't pass value for Request.Form("From"). So assign value for the field like you did for other fields like Subject, To.,
 
Share this answer
 
In your html code, you stipulate


This is indicating that the form field name for the recipient is Custemail; however, in your asp code, you mixed the potential value for that field with the form field name.

objMail.To = Request.Form("csaeed@gmail.com")

If the recipient email value (the value of the To: field) will always be the same, then code as such:

objMail.To = "csaeed@gmail.com"

In the Request.Form usage, the field name should always be where you put the email in this situation. You don't need that code reference. Only the value in quotes ("value").
 
Share this answer
 
Comments
Richard Deeming 27-Jan-21 4:07am    
A good catch. But hopefully the OP will have solved their problem some time in the last 7½ years. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900