Click to See Complete Forum and Search --> : Does Anyone Know


dennic
08-29-2003, 03:45 AM
I am only just starting to learn the basics for asp, I have tried to do some code (with some help from a site) for a basic form to email script.

I dont know if i have done it correctly, because it doesnt seem to be working right. I have written the code and saved it as a separate file to the email form.

here is the asp code




'Fields to collect the information

<%
strName = Request.QueryString("Name")
strCompanyName = Request.QueryString("CompanyName")
strEmail = Request.QueryString("Email")
strMobileNumber = Request.QueryString("MobileNumber")
strFaxNumber = Request.QueryString("FaxNumber")
strComments = Request.QueryString("Comments")
%>

'Tells the customer what they have sent

Name: <%= strName %>
Company Name: <%= strCompanyName %>
Email: <%= strEmail %>
Mobile Number: <%= strMobileNumber %>
Fax Number: <%= strFaxNumber %>
Comments: <%= strComments %>

'Sends to info@dennic.com.au

<%
Set objCDOMessage = Server.CreateObject("CDONTS.NewMail")
'Creates the object
objCDO.Message.From = "customer@yahoo.com"
objCDO.Message.To = "info@dennic.com.au"
objCDO.Message.Subject = "Customer Enquiry Form"
objCDO.Message.Body = "The following information is submitted from customer" & vbcrlf &_

"Name:" & strName & vbcrlf &_
"Company Name:" & strCompanyName & vbcrlf &_
"Email:" & strEmail & vbcrlf &_
"Mobile Number:" & strMobileNumber & vbcrlf &_
"Fax Number:" & strFaxNumber & vbcrlf &_
"Comments:" & strComments

'Send the message
objCDOMessage.Send
'Finsh things off
Set objCDOMessgae = Nothing
%>

I think this line is wrong

TBor
08-29-2003, 09:28 AM
I noticed that your email object is called objCDOMessage, but you're referencing it when setting To, From, etc. as objCDO.Message. You'll need to change these to (example):

objCDOMessage.To = "someone@home.com"

If this still doesn't work and you're getting any specific errors, post them here and I'll take another stab at this.

Hope this helps,
TBor

dennic
08-29-2003, 05:22 PM
wouldnt i have to specify that it is info@dennic.com.au? can you tell me what i put for the line above it, where it says

objCDO.Message.From = "customer@yahoo.com"

what do i replace the "customer@yahoo.com" with?

thanks for you response

TBor
09-02-2003, 08:55 AM
Sorry, should have been more clear:

When you're setting up your email object in the following line:

Set objCDOMessage = Server.CreateObject("CDONTS.NewMail")

You have called the object "objCDOMessage". However, when you are setting the properties of that object (i.e. "To", From", "Subject", etc.), you are calling the object "objCDO.Message" (notice the period in there). Take that period out and you should be good to go.

For example, your "From" line should be changed from:

objCDO.Message.From = "customer@yahoo.com"

to...

objCDOMessage.From = "customer@yahoo.com"

Do the same thing for your "To", "Subject", and "Body" lines and things should work. What you set these properties to is your call, depending on what you want the email to say & who you want it to be sent to.

Hope this helps,
TBor

dennic
09-03-2003, 05:29 AM
so does that mean whenever i receive an email, i wil get a response with from "customer@yahoo.com"?
thanks for your help to mate

dennic
09-03-2003, 06:14 AM
hey that works, thanks dude. just one more question, when someone submits the form, how do i redirect them to another page?

e.g. a thankyou page

TBor
09-03-2003, 08:10 AM
No prob.

As for sending the user to a new page, throw this at the bottom (before the "%>"):

Response.redirect(thanks.asp)

where "thanks.asp" is the name of the page you want to forward the user to.

dennic
09-03-2003, 07:44 PM
your a genius!
that works exactly how i want it to, except for one thing, when i click on submit and it goes through to the thankyou page, it says it gets done, but with errors on it.

check out the site if you want and go to the contact page

www.dennic.com.au

TBor
09-04-2003, 02:46 PM
Thanks!
Tried your page, looks like it works for me - didn't see any errors on my end at least. If you're getting the thank you page displaying but the status bar says there were errors, the problem's likely on the thank you page somewhere. If the email is getting to you correctly, the Contact Us page would seem to be working correctly.

TBor

PeOfEo
09-04-2003, 07:16 PM
Lol tbor, that was my old avatar, back in the day.