2

Every time I send the form it brings me to this error: Object required: 'objCDOSYSCon'

I have tried changing things. I have put the right info in for username and password. I have checked it twice. I have done everything I possible could to get this to work.

Thank you very much in advance for the help.

This is my ASP code:

<!-- #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

%>
TylerH
  • 20,799
  • 66
  • 75
  • 101

1 Answers1

0

You've called your configuration object cdoConfig, so you need to use that in place of 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 

Or looking at the way you've written it, just do it this way

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 
John
  • 4,658
  • 2
  • 14
  • 23
  • It's now giving me another error for the .send ... :( 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 – user3399204 Mar 09 '14 at 19:36
  • CDO.Message.1 error '80040213' The transport failed to connect to the server. /asp/email.asp, line 55 – user3399204 Mar 09 '14 at 19:57
  • That probably means that you need to add more configuration fields, or at worst it could mean that you don't actually have a SMTP server set up on your machine – John Mar 09 '14 at 20:03
  • See this question http://stackoverflow.com/questions/9669644/send-mail-with-cdo-through-google-apps-gives-transport-error-cdo-message-1-erro – John Mar 09 '14 at 20:05