-1
我想從我的網絡服務器發送郵件到其他郵件服務使用smtp。我搜索網絡,我發現了一個代碼。所以我創建了一個名爲cdosys.asp的示例頁面,在此之後,我放置在我的godaddy服務器上並添加了必需的smtp地址,但是當我發送它時會給我和錯誤。SMPT郵件發送錯誤與ASP CLASSIC
錯誤 '8004020e'
/cdosys.asp 42行
<%
'----------------------------------------------------------------------------
'
' Send email using the CDOSYS component
'
' by Chris Hardy
' http://www.chrishardy.co.uk/
'
'----------------------------------------------------------------------------
Option Explicit
dim sName, sEmail, sMessage
dim oCdoMail, oCdoConf, sConfURL
if Request.Form("Action") <> "" then
sName = Request.Form("Name")
sEmail = Request.Form("Email")
sMessage = Request.Form("Message")
Set oCdoMail = Server.CreateObject("CDO.Message")
Set oCdoConf = Server.CreateObject("CDO.Configuration")
sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
with oCdoConf
.Fields.Item(sConfURL & "sendusing") = 2
.Fields.Item(sConfURL & "smtpserver") = "smtpout.secureserver.net"
.Fields.Item(sConfURL & "smtpserverport") = 80
.Fields.Update
end with
with oCdoMail
.From = "[email protected]"
.To = sEmail
.Subject = "My message subject"
.TextBody = sMessage
.HTMLBody = sMessage
.Configuration = oCdoConf
.Send
end with
Set oCdoConf = Nothing
Set oCdoMail = Nothing
response.write "Thanks for your message!"
else
%>
<form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<p>Name:<br /><input type="text" name="Name" /></p>
<p>E-mail:<br /><input type="text" name="Email" /></p>
<p>Message:<br /><textarea name="Message"></textarea></p>
<p><input type="submit" name="Action" value="Send" /></p>
</form>
<%
end if
%>
仍然給出了同樣的錯誤消息 – blay
看起來像Godaddy的有,你必須使用特定的郵件服務器。在我編輯的答案中見編號5。 – johna
是的,它的工作。它必須處理smpt服務器 – blay