CDO.Message.1错误'8004020d' [英] CDO.Message.1 error '8004020d'
问题描述
我是asp的新手,我正在尝试设置表单。当我发送表单时,我收到以下错误:
CDO.Message.1错误'8004020d'
至少需要一个From或Sender字段,但都没有找到。
这是我的代码:
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:
<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>
我的ASP看起来像这样:
My ASP looks like this:
<%
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
%>
推荐答案
CDO.Message.1错误'8004020d'
至少需要一个From或Sender字段,但都没有找到。
CDO.Message.1 error '8004020d'
At least one of the From or Sender fields is required, and neither was found.
错误消息清楚地告诉你,你没有' t传递From / Sender字段的值。我检查了你的代码和发现你没有为 Request.Form(From)
传递值。因此,像对象,To。,
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.,
这篇关于CDO.Message.1错误'8004020d'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!