0

この情報をフォームから送信するときにこの問題をデバッグしようとしていますが、このエラーが発生し続けます。

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

私はaspで多くの作業を行っていませんが、以前の開発者からこのファイルを少しきれいにすることができました(まだエラーがありました)。エラーは.Send..それを明確にするのを忘れた場所で発生します。

これがコードです。どんな助けでも大歓迎です。

'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

Google を使用してエラー コードを調べたところ、データの送信に問題があることを意味するサイトが多数見つかりました。それは別のトラブルの原因になる可能性があります。

交換するとどうなるか

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

.Item(cdoSendUsingMethod) = 1 'cdoSendUsingPickup

追加のコメントなしで試してみてください。

于 2013-08-06T14:58:08.547 に答える
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 に答える