nprignano
asked on
CDO.Message.1 error '8004020d'
I have made a few simple CDO email forms with ASP, and have them running on a page we host on our servers. Problem is the page displays fine because the code is after the HTML, but we are getting a code error at the bottom of the page when the server generates the page. Can you see anything I did wrong?
Error:
CDO.Message.1 error '8004020d'
At least one of the From or Sender fields is required, and neither was found.
/signup.asp, line 308
(line 308: objCDOSYSMail.Send )
ASP:
<%
'create variables to store user input
Dim strFirstName, strLastName, strEmail, strText
'Dimension variables
Dim objCDOSYSCon
'set variables to the values of user input
strEmail = Request.Form("Email")
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
strAddress = Request.Form("Address")
strPhone = Request.Form("Phone")
strCompany = Request.Form("Company")
strTitle = Request.Form("Title")
strLit = Request.Form("Literature")
strSales = Request.Form("Salesperson" )
strTech = Request.Form("TechSupport" )
strText = "I am requesting additional infomation: " & strLit & strTech & strSales & vbCrLf & vbCrLf &_
"Name: " & strFirstName & strLastName & vbCrLf & vbCrLf &_
"Title: " & strTitle & vbCrLf & vbCrLf &_
"Company: " & strCompany & vbCrLf & vbCrLf &_
"Address: " & strAddress & vbCrLf & vbCrLf &_
"Phone: " & strPhone & vbCrLf & vbCrLf &_
"Email: " & strEmail & vbCrLf
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.M essage")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "webserver.mydomain.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuratio n = objCDOSYSCon
objCDOSYSMail.From = strEmail
objCDOSYSMail.To = "info@mydomain.com"
objCDOSYSMail.Subject = "Info Request"
objCDOSYSMail.TextBody = strText
objCDOSYSMail.Send
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
'Redirect the user to a cofirmation page
Response.Redirect("http://www.mydomain.com/confirmation.asp")
%>
Error:
CDO.Message.1 error '8004020d'
At least one of the From or Sender fields is required, and neither was found.
/signup.asp, line 308
(line 308: objCDOSYSMail.Send )
ASP:
<%
'create variables to store user input
Dim strFirstName, strLastName, strEmail, strText
'Dimension variables
Dim objCDOSYSCon
'set variables to the values of user input
strEmail = Request.Form("Email")
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
strAddress = Request.Form("Address")
strPhone = Request.Form("Phone")
strCompany = Request.Form("Company")
strTitle = Request.Form("Title")
strLit = Request.Form("Literature")
strSales = Request.Form("Salesperson"
strTech = Request.Form("TechSupport"
strText = "I am requesting additional infomation: " & strLit & strTech & strSales & vbCrLf & vbCrLf &_
"Name: " & strFirstName & strLastName & vbCrLf & vbCrLf &_
"Title: " & strTitle & vbCrLf & vbCrLf &_
"Company: " & strCompany & vbCrLf & vbCrLf &_
"Address: " & strAddress & vbCrLf & vbCrLf &_
"Phone: " & strPhone & vbCrLf & vbCrLf &_
"Email: " & strEmail & vbCrLf
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.M
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "webserver.mydomain.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuratio
objCDOSYSMail.From = strEmail
objCDOSYSMail.To = "info@mydomain.com"
objCDOSYSMail.Subject = "Info Request"
objCDOSYSMail.TextBody = strText
objCDOSYSMail.Send
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
'Redirect the user to a cofirmation page
Response.Redirect("http://www.mydomain.com/confirmation.asp")
%>
ASKER
Well, this was happening whe the page was loaded, not when the form was submitted. I had the code on the same page as the html that was posting the results. As a test, I have removed the code and placed it on a seperate asp file. I will let you know what happens, but this is what I am anticipating:
the page with the form will display and function fine,
the form will submit the results to the form handler,
the form handler will fail and the email will not be sent.
but i will let you know.
thanks for the insight.
the page with the form will display and function fine,
the form will submit the results to the form handler,
the form handler will fail and the email will not be sent.
but i will let you know.
thanks for the insight.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, now i get the following when submitting the form:
error '8004020f'
there are no other details than the error occurred on line 39 of the form handler:
objCDOSYSMail.Send
any ideas?
error '8004020f'
there are no other details than the error occurred on line 39 of the form handler:
objCDOSYSMail.Send
any ideas?
ASKER
when I try with IE, I get the following:
Microsoft VBScript runtime error '800a01a8'
Object required: 'objCDOSYSCon'
/signup_mail.asp, line 34
Microsoft VBScript runtime error '800a01a8'
Object required: 'objCDOSYSCon'
/signup_mail.asp, line 34
This link may help with the '8004020f' error
http://www.aspfaq.com/show.asp?id=2305
The second error looks like your referencing an object thats not defined (objCDOSYSCon) . Did you change the code and forget to comment something out?
http://www.aspfaq.com/show.asp?id=2305
The second error looks like your referencing an object thats not defined (objCDOSYSCon) . Did you change the code and forget to comment something out?
ASKER
exactly the case. just missed a couple instances. the forms are working fine now. thanks again.
After this line of code:
strEmail = Request.Form("Email")
do a
response.write "<br><br>Request.Form('Ema
Preece