我正在做一个ASP联系表格,由于某些原因我不断得到这个。
服务器对象错误'ASP 0177:800401f3'
Server.CreateObject失败
/confirmation.asp,第10行
800401f3
我认为我的SMTP有问题,请任何帮助都会感激不尽。
<%
DIM strEmail, strFirstName, strLastName, strSubject, strComments
strEmail = request.form("Email")
strFirstName = request.form("FirstName")
strLastName = request.form("LastName")
strSubject = request.form("Subject")
strComments = request.form("Comments")
DIM Mailer,strMsgHeader, qryItem, strMsgInfo
Set Mailer = Server.CreateObject("smtpout.secureserver.net")//this line might be wrong.
Mailer.FromName = "Web Designs"
Mailer.FromAddress= "carlos@example.net"
Mailer.ReplyTo = strEmail
Mailer.RemoteHost = "mail.example.net"
Mailer.AddRecipient "", ""
Mailer.Subject = "Online Inquiry"
strMsgHeader = "This mail message was sent from the Online Form" & vbCrLf & vbCrLf
Mailer.BodyText = strMsgHeader & vbCrLf & "Email: " & Request.Form("Email") & _
vbCrLf & "First Name: " & Request.Form("FirstName") & _
vbCrLf & "Last Name: " & Request.Form("LastName") & _
vbCrLf & "Subject: " & Request.Form("Subject") & _
vbCrLf & "Comments: " & Request.Form("Comments")
IF Mailer.SendMail THEN
Response.Write strFirstName & ",<br>"
Response.Write "Your message has been successfully sent."
ELSE
Response.Write "The following error occurred while sending your message: " & Mailer.Response
END IF
%>
答案 0 :(得分:1)
您似乎混淆了“发送电子邮件库”和SMTP配置。
梅勒应该看起来像
Set Mailer = Server.CreateObject("CDO.Message")
(虽然这可能取决于您的IIS版本)
要配置SMTP,您应该使用此对象:
Set cdoConfig = CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(cdoSMTPServer) = "smtpout.secureserver.net"
编辑:示例代码:CDO Classic ASP form not working