每次我发送表格会给我带来此错误:必需的对象:'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
%>
您已经调用了配置对象cdoconfig,因此您需要使用它代替objcdosyscon -IE
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