【问题标题】:ASP ERROR: Object required: 'objCDOSYSCon'ASP 错误:需要对象:'objCDOSYSCon'
【发布时间】:2014-03-09 18:44:55
【问题描述】:

每次我发送表单时都会出现这个错误:Object required: 'objCDOSYSCon'

我尝试过改变一些事情。我已经为用户名和密码输入了正确的信息。我已经检查了两次。我已尽我所能让它发挥作用。

非常感谢您的帮助。

这是我的 ASP 代码:

<!-- #INCLUDE FILE="function.asp" -->
<%
if not isempty(request.form("MembershipSignUp")) then
FirstName=required(request.form("FirstName"),"First Name")
LastName=required(request.form("LastName"),"Last Name")
BillToAddress=request.form("BillToAddress")
City=required(request.form("City"),"City")
Quebec=request.form("Quebec")
PostalCode=required(request.form("PostalCode"),"Postal Code")
Phone=required(request.form("Phone"),"Phone")
CellPhone=required(request.form("CellPhone"),"CellPhone")
MembershipLevel=required(request.form("MembershipLevel"),"Membership Level")
SpecialInsterests=required(request.form("SpecialInsterests"),"Special Insterests")
Announcements=request.form("Announcements")


mailto="kelsey.boyd@hotmail.ca"

subject=Firstname&" "&Lastname&" wants to sign up for a membership"
body="First Name:" &firstname&"<br>Last Name:"&lastname&"<br>Bill To Address:"&BillToAddress&"<br>City: "&City&"<br>Quebec: "&Quebec&"<br>Postal Code: "&PostalCode&"<br>Phone: "&Phone&"<br>Cell Phone:"&CellPhone&"<br>Membership Level:"&MembershipLevel&"<br>Special Insterests:"&SpecialInsterests&"<br>Announcements:"&Announcements
call mailit() 
response.redirect "www.google.ca" 
end if

if not isempty(request.form("MembershipSignUpHomePage")) then
Name=required(request.form("Name"),"Name")
Email=required(request.form("Email"),"Email")


mailto="kboyd@itm.com"

subject=Name&" wants to sign up for the newsletter"
.TextBody="Name:" &Name&"<br>Email:"&Email
call mailit() 
response.redirect "www.google.ca" 
end if

sub mailit()
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields 
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 
'Your UserID on the SMTP server'
objCDOSYSCon.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Info@domain.ca"
'Your password on the SMTP server'
objCDOSYSCon.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
.Update 
End With 

Set cdoMessage = CreateObject("CDO.Message") 
With cdoMessage
Set .Configuration = cdoConfig
.From = "info@seniorsactionquebec.ca" 
.To = "info@seniorsactionquebec.ca" 
.Subject = "TEST MCW" 
.TextBody = "This is a test for CDO.message" 
.Send 
End With 
Set cdoMessage = Nothing
end sub

%>

【问题讨论】:

    标签: php asp.net forms asp-classic


    【解决方案1】:

    您已经调用了配置对象 cdoConfig,因此您需要使用它来代替 objCDOSYSCon - 即

    cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Info@domain.ca"
    'Your password on the SMTP server'
    cdoConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
    .Update 
    End With 
    

    或者看你写的方式,就这样吧

    With cdoConfig.Fields 
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" 
      'Your UserID on the SMTP server'
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Info@domain.ca"
      'Your password on the SMTP server'
      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"
    .Update 
    End With 
    

    【讨论】:

    • 它现在给我另一个错误 .send ... :( Set cdoMessage = CreateObject("CDO.Message") With cdoMessage Set .Configuration = cdoConfig .From = "info@seniorsactionquebec.ca " .To = "info@seniorsactionquebec.ca" .Subject = "TEST MCW" .TextBody = "这是对 CDO.message 的测试" .Send End With Set cdoMessage = Nothing end sub
    • CDO.Message.1 错误“80040213”传输无法连接到服务器。 /asp/email.asp,第 55 行
    • 这可能意味着您需要添加更多配置字段,或者最坏的情况可能意味着您的机器上实际上没有设置 SMTP 服务器
    猜你喜欢
    • 1970-01-01
    • 2016-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多