movoni
asked on
Automatic Email After [Dreamweaver MX '04] Record Insert
All --
I'm asking here instead of Dreamweaver as I beleive this to be more ASP-related. That said, I am using Dreamweaver MX 2004.
My page has a really long form, so I'll spare you that code. However, it inserts the form into an SQL db. That works fine. Then I have the code below to automatically email the user saying thanks for filling out the form, etc., etc. The email goes out fine. However, I want it to also send variables from the form -- username and password. It also has to pull from the form's email field to get the user's email address. The variables just won't work no matter where I drop it into the page -- I've tried both session variables and form.requests. I can't get it to send the variables over to the next page (a thanks page) or to the email that the user gets. Here's the code for the email itself.
'*********** SEND EMAIL AFTER DB OPERATIONS ***********
Dim myMail
Set myMail = CreateObject("CDONTS.NewMa il")
'myMail.AttachURL "c:\images\logo.gif", "logo.gif"
'myMail.AttachURL "c:\images\new.gif", "new.gif"
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type" ""
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<title>Your Account</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"">"
HTML = HTML & "<p><font size=""2"" face=""""Arial, Helvetica, sans-serif"">Dear"
HTML = HTML & Request.Form("FIRST_NAME")
HTML = HTML & ",</font></p>"
HTML = HTML & "<p><font size=""2"" face=""Arial, Helvetica, sans-serif"">Thank you for submitting your information blah, blah, blah.</font></p>"
HTML = HTML & "<p><font size=""2"" face=""Arial, Helvetica, sans-serif"">For your convienience, you may edit your Profile at any time by visiting our <a href=""http://www.blah.com"">Client Admin Interface</a>. Your username is"
HTML = HTML & Request.Form("CLIENT_USERN AME")
HTML = HTML & " and your password is "
HTML = HTML & Request.Form("CLIENT_PASSW ORD")
HTML = HTML & "<p>Email continues with more blah, blah."
HTML = HTML & "</body>"
HTML = HTML & "</html>"
myMail.From = "admin@movoni.com"
myMail.To = Request.Form("CLIENT_EMAIL ")
myMail.Subject = "Your Movoni Account"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
'*********** END SEND EMAIL ***********
Thanks,
MT
I'm asking here instead of Dreamweaver as I beleive this to be more ASP-related. That said, I am using Dreamweaver MX 2004.
My page has a really long form, so I'll spare you that code. However, it inserts the form into an SQL db. That works fine. Then I have the code below to automatically email the user saying thanks for filling out the form, etc., etc. The email goes out fine. However, I want it to also send variables from the form -- username and password. It also has to pull from the form's email field to get the user's email address. The variables just won't work no matter where I drop it into the page -- I've tried both session variables and form.requests. I can't get it to send the variables over to the next page (a thanks page) or to the email that the user gets. Here's the code for the email itself.
'*********** SEND EMAIL AFTER DB OPERATIONS ***********
Dim myMail
Set myMail = CreateObject("CDONTS.NewMa
'myMail.AttachURL "c:\images\logo.gif", "logo.gif"
'myMail.AttachURL "c:\images\new.gif", "new.gif"
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"
HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
HTML = HTML & "<title>Your Account</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body bgcolor=""#FFFFFF"">"
HTML = HTML & "<p><font size=""2"" face=""""Arial, Helvetica, sans-serif"">Dear"
HTML = HTML & Request.Form("FIRST_NAME")
HTML = HTML & ",</font></p>"
HTML = HTML & "<p><font size=""2"" face=""Arial, Helvetica, sans-serif"">Thank you for submitting your information blah, blah, blah.</font></p>"
HTML = HTML & "<p><font size=""2"" face=""Arial, Helvetica, sans-serif"">For your convienience, you may edit your Profile at any time by visiting our <a href=""http://www.blah.com"">Client Admin Interface</a>. Your username is"
HTML = HTML & Request.Form("CLIENT_USERN
HTML = HTML & " and your password is "
HTML = HTML & Request.Form("CLIENT_PASSW
HTML = HTML & "<p>Email continues with more blah, blah."
HTML = HTML & "</body>"
HTML = HTML & "</html>"
myMail.From = "admin@movoni.com"
myMail.To = Request.Form("CLIENT_EMAIL
myMail.Subject = "Your Movoni Account"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
'*********** END SEND EMAIL ***********
Thanks,
MT
movoni,
make sure the fieldname that you're trying to request is correct.
x_com
make sure the fieldname that you're trying to request is correct.
x_com
ASKER
That didn't do it x. :(
It's frustrating that I really can't post all of my code (for various reasons), but to shed some light, I did create a form on a brand new page with nothing but one field and a button. The request.form worked on that test page *IF* I turned the code into a Sub routine and called the Sub from the button like this: onclick="<% CALL SendMail() %>">
However, if I take that call away (and take away the Sub/End Sub) and try to let it run without any user action (like I am trying to do in my question above), the variables aren't read. Weird.
It's frustrating that I really can't post all of my code (for various reasons), but to shed some light, I did create a form on a brand new page with nothing but one field and a button. The request.form worked on that test page *IF* I turned the code into a Sub routine and called the Sub from the button like this: onclick="<% CALL SendMail() %>">
However, if I take that call away (and take away the Sub/End Sub) and try to let it run without any user action (like I am trying to do in my question above), the variables aren't read. Weird.
movoni,
Can you get value for Request.Form("FIRST_NAME") in this form?
Use
Response.Write(Request.For m("FIRST_N AME"))
to see what you get. Make sure you're not getting a blank value.
-You have 1 page or 2 page in this case? Are you trying to re-post to same page or others page?
Regards
x_com
Can you get value for Request.Form("FIRST_NAME")
Use
Response.Write(Request.For
to see what you get. Make sure you're not getting a blank value.
-You have 1 page or 2 page in this case? Are you trying to re-post to same page or others page?
Regards
x_com
ASKER
Hmmm... I took away the success page link so the form doesn't go anywhere after it submits and ya' know what... the response.write isn't showing up. So... lemme move that little response.write around until it shows up, them we'll go from there. Hold pls ;)
Thanks,
MT
Thanks,
MT
movoni,
Possible to show your full code here?maybe you can make a dumb code here.
This mean you're re-post the submitted value into same page?Try to use Response.Write() untill you see the value if you not intend to post your code here. Then, your problems should be solve.
Regards
x_com
Possible to show your full code here?maybe you can make a dumb code here.
This mean you're re-post the submitted value into same page?Try to use Response.Write() untill you see the value if you not intend to post your code here. Then, your problems should be solve.
Regards
x_com
Can you post your querystring from your previous page that is calling this page.
ASKER
rp - I'm going to clean up the code so I can post it publicly. I'll mess with that and trying to get the response.write to work too (from above in the thread). I'm going to work on it a little more first. Be back sometime tomorrow...
Thanks,
MT
Thanks,
MT
movoni,
Put this two statement for any debug process :
Response.Write()
Response.End
Waiting you to post the whole code here.
x_com
Put this two statement for any debug process :
Response.Write()
Response.End
Waiting you to post the whole code here.
x_com
movoni,
How do you post when you insert the data on the insert statement... I mean the form action
1. post it on the same page...
2. post it on other page...
If you will put the value son other form or pages... This is just an educated guess instead of using response.redirect try to use server.transfer...
For more info try to chek out the link....
http://www.w3schools.com/asp/met_transfer.asp
HTH...
HAppy programming...
How do you post when you insert the data on the insert statement... I mean the form action
1. post it on the same page...
2. post it on other page...
If you will put the value son other form or pages... This is just an educated guess instead of using response.redirect try to use server.transfer...
For more info try to chek out the link....
http://www.w3schools.com/asp/met_transfer.asp
HTH...
HAppy programming...
ASKER
I'll check that out. Since this app is being developed in Dreamweaver, I am using their built-in Behaviors (otherwise I'd still be stuck at the <BODY> tag ;) Dreamweaver makes the code for inserting a record with a single mouse click on the development side. The form action points to an ASP sub routine and that sub has a ton of code that I barely understand. I basically filled out a form and said insert these fields into the db and then take the users to this "thanks" page.
What I'm trying to do is email them a thanks as well. The form is POST (GET doesn't work) so I can carry on a URL variable that I know of. What I've been trying to do is paste my initial code above into the area just before the form data is inserted into the db and just after the form validation tags. The email goes out no matter where I paste the code for the most part... it's the doggone variables that I can't get to go into the email.
Whew. I don't think it makes since to post ALL of my code for my own parnoid reasons, but I'm going to try to clean it up or maybe duplicate what I'm trying to do in another file. I'll take a look at your link.
Thanks!
Michael
What I'm trying to do is email them a thanks as well. The form is POST (GET doesn't work) so I can carry on a URL variable that I know of. What I've been trying to do is paste my initial code above into the area just before the form data is inserted into the db and just after the form validation tags. The email goes out no matter where I paste the code for the most part... it's the doggone variables that I can't get to go into the email.
Whew. I don't think it makes since to post ALL of my code for my own parnoid reasons, but I'm going to try to clean it up or maybe duplicate what I'm trying to do in another file. I'll take a look at your link.
Thanks!
Michael
ASKER
I meant I "CAN'T" carry a URL string with POST that I know of (plus, I wouldn't really want that long of a URL... the form is big).
- MT
- MT
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok guys... I fixed it.
I learned that you cannot use request.form on enctype forms. After some research into the file upload component that I am using for Dreamweaver (PureUpload 2.1), I found out that I can use a special tag -- UploadFormRequest("field here"). I set a session variable using that call to a single form field that is also a unique key in my SQL db. I use the success page ("thanks page") to send the email to my customer.
I'm going to split the points between ap and x for all of their time and help. Some of the thing they told me helped me to find my answer.
Thanks guys! Hopefully this post will help someone else one day.
- Michael
I learned that you cannot use request.form on enctype forms. After some research into the file upload component that I am using for Dreamweaver (PureUpload 2.1), I found out that I can use a special tag -- UploadFormRequest("field here"). I set a session variable using that call to a single form field that is also a unique key in my SQL db. I use the success page ("thanks page") to send the email to my customer.
I'm going to split the points between ap and x for all of their time and help. Some of the thing they told me helped me to find my answer.
Thanks guys! Hopefully this post will help someone else one day.
- Michael
ASKER
Sorry.. and I meant glad too because his articles helped me figure this out too.
Glad to help, movoni
Regards
x_com
Regards
x_com
Try this :
Instead of Request.Form()
change to
Request()
Eg:
Request.Form("CLIENT_EMAIL
Change to
Request("CLIENT_EMAIL")
Regards
x_com