0

从表单发送此信息时,我正在尝试调试此问题,但我不断收到此错误。

error '8004020e'
/contacthandler.asp, line 45

我在asp中没有做太多工作,但我已经设法从以前的开发人员那里清理了一点这个文件(仍然有错误)。错误发生在.Send..forgot 澄清这一点。

这是代码。任何帮助表示赞赏。

'declare variables
dim name, phone, email, comment, service, returnPage

'set variables to the corresponding fields from contact form
name = request.form("custName")
phone = request.form("custPhone")
email = request.form("custEmail")
comment = request.form("custNotes")
service = request.form("service")
returnPage = request.form("page")

dim theEmail
' set the email content data
theEmail = "<h3>Contact from website, information below.</h3><table border='0'><tr><th>Customer Name:<td>"&name
theEmail = theEmail&"<tr><th>Phone Number:<td>"&phone&"<tr><th>Email Address:<td>"&email&"<tr><th>Service Category:<td>"&service
theEmail = theEmail&"<tr><th valign='top'>Comments/Notes:<td>"&comment&"</table>"

' send the email

dim sch
sch = "http://schemas.microsoft.com/cdo/configuration/" 

Set cdoConfig = CreateObject("CDO.Configuration") 


With cdoConfig.Fields 
    .Item(sch & "sendusing") = 2 ' cdoSendUsingPort 
    .Item(sch & "smtpserverport") = 587
    .Item(sch & "smtpserver") = "smtp.office365.com"
    .Item(sch & "smtpauthenticate") = 1
    .Item(sch & "sendusername") = "########"
    .Item(sch & "sendpassword") = "########"
    .update 
End With 

Set cdoMessage = CreateObject("CDO.Message") 

With cdoMessage 
    Set .Configuration = cdoConfig 
    .From = name & "<" & email & ">" 
    .To = "info@mywebsite.com" 
    .Subject = "Website - "&service&" Request" 
    .HTMLBody = theEmail
    .Send 
End With 

Set cdoMessage = Nothing 
Set cdoConfig = Nothing 


'response.write "sent, check the mail"
response.redirect "thankyou.asp"
'returnPage&".asp"
4

2 回答 2

0

MSDN ( http://msdn.microsoft.com/en-us/library/ms527318%28v=exchg.10%29.aspx ) 建议您需要.From按如下方式格式化您的字段:

.From """" & name & """ <" & email & ">"
于 2013-08-06T14:46:38.673 回答
0

我用谷歌查找错误代码,发现很多网站都表示发送数据存在问题。这可能是另一个麻烦的来源。

如果更换会发生什么

.Item(sch & "sendusing") = 2 ' cdoSendUsingPort

经过

.Item(cdoSendUsingMethod) = 1 'cdoSendUsingPickup

额外尝试,没有任何评论。

于 2013-08-06T14:58:08.547 回答