473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Email from form

347 100+
HI

I was wondering if it is possible to send text from a form to a web page via a cdo email.

I.e> can i have someone type in a message in a form and then have the form directed to a cdo email asp page and have that generate the email from a webpage that will contain the typed text.

I have it all working but just wanted to know if i could add a personal message to a page as it is for marketing perposes

thanks for any help
Jul 15 '09 #1
7 2435
jhardman
3,406 Expert 2GB
The easiest way to send data would be in querystring, but that is of course somewhat limited. But if you just want to have a personalized response that would be easiest. In fact a lot of marketers encode the image links with querystring data (<img src="www.mydomain.com/images/imagetracker.cgi?imgID=2345&emailID=your_name-domain.com">) so that when the message is opened they know. That's why my email client (and I would assume a lot of other clients) blocks images by default if they aren't attached to the message.

Most email clients will accept HTML pages as email messages, whether they will interpret the form correctly may depend on the client. Definitely test to make sure, but I would bet most would interpret it just fine.

Jared
Jul 15 '09 #2
colinod
347 100+
yes i thought that a querystring would be the way to go, what i cant figure out is the code in the cdo email page that will code the link and send the querystring

i have a form with a field called body2 that will hold the text i wanted to add and an email asp page that generates the email from a hidden field in the form called link, as follows

hidden field in form
Expand|Select|Wrap|Line Numbers
  1. <input name="link" type="hidden" value="http://www.yaketyyak.co.uk/mailout/viewshortlist3.asp?cart=<%= server.urlEncode( session("recordsInCart")) %>">
body 2 field in form
Expand|Select|Wrap|Line Numbers
  1. <TEXTAREA name="body2" id="body2" cols="40" rows="5"></TEXTAREA>
in the email asp page the line that generates the email from web page is as follows
Expand|Select|Wrap|Line Numbers
  1. usrmail.CreateMHTMLBody Request.Form("link")
this all works fine but i cant add the querystring, i have tried
Expand|Select|Wrap|Line Numbers
  1. usrmail.CreateMHTMLBody Request.Form("link") & "?text=" & Request.Querystring("body2")
But that does not seem to work
Jul 15 '09 #3
colinod
347 100+
hi

i hope someone can help with this.

I have managed to get the url to get itself together in the following code, what i cant do is get the cdo CreateMHTMLBody to generate the email using the generated url which i have stored in a variable

Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3. 'Sends an email
  4. URL = Request.Form("link") & "&text=" & Request.Form("body2")
  5. response.write URL
  6. Dim usrmail
  7. Set usrmail=Server.CreateObject("CDO.Message")
  8. usrmail.To=Request.Form("To")
  9. usrmail.From="voiceovers@yaketyyak.co.uk"
  10. usrmail.Bcc=Request.Form("Bcc1")
  11. usrmail.Subject=Request.Form("Subject")
  12. usrmail.CreateMHTMLBody URL
  13. usrmail.Send()
  14. Response.Write("")
  15. 'Destroy the mail object!
  16. Set usrmail = nothing
  17. %>
Jul 16 '09 #4
colinod
347 100+
have now changed it again and found what is stopping it from working i just dont know how to fix iy

code is

Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3. 'Sends an email
  4. Dim usrmail
  5. Dim usrcart
  6. Dim usrtext
  7. usrcart = Request.Form("link") & "&text=" & Request.Form("body2")
  8. Response.Write (usrcart)
  9. Set usrmail=Server.CreateObject("CDO.Message")
  10. usrmail.To=Request.Form("To")
  11. usrmail.From="voiceovers@yaketyyak.co.uk"
  12. usrmail.Bcc=Request.Form("Bcc1")
  13. usrmail.Subject=Request.Form("Subject")
  14. usrmail.CreateMHTMLBody "http://www.yaketyyak.co.uk/mailout/viewshortlist3.asp" & usrcart
  15. usrmail.Send()
  16. Response.Write("")
  17. 'Destroy the mail object!
  18. Set usrmail = nothing
  19. %>
problem is when the Request.Form("body2") variable contains spaces, this is where the personal bit of text i want to be on the web page that makes the email is contained!!!!

Any help would be appreciated
Jul 16 '09 #5
jhardman
3,406 Expert 2GB
Try this:
Expand|Select|Wrap|Line Numbers
  1. usrcart = Request.Form("link") & "&text=" & _
  2. server.urlencode(Request.Form("body2"))
  3.  
(converts a string to make it compatible with URLs

Jared
Jul 16 '09 #6
colinod
347 100+
Thanks for that, works ok but does anyone know how to get any line returns entered in the form to appear on the page the text is on, i can do it by typing in HTML <BR> tags but was hoping for something else
Jul 17 '09 #7
colinod
347 100+
sorted it now thanks just used the replace funtion to replace all the encoded characters
Jul 17 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: bojanraic | last post by:
Hi! I recently started playing with Python CGI, and I was happy that my basic input-name--print-hello-name CGI form example worked, so I thought I should advance to somew\hat more complicated...
4
by: dmiller23462 | last post by:
So here's my problem.....I need to set up different email distributions based on which option in the following Select form has been chosen....For instance if "Putaway" is chosen it needs to email...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
4
by: Ken D. | last post by:
I have an asp page that collects data on referrals. The user inputs the information and selects the rep to receive the referral. My data is being saved to a backend database (SQL) and the user is...
26
by: libsfan01 | last post by:
Hi all! Can anyone show me how to check and email field on a form for the existence of these two characters. Kind regards Marc
2
by: kennykenn | last post by:
Hi, Ive producd code to send an email after capturing info off a form,it works fine locally but when i put it live it doesnt work! the code is stopin at 'msg.send' any ideas, here the code! ...
5
by: simononestop | last post by:
Hi im totally new to perl this is my first go at using it (I normally use asp). I have set up a form with a cgi script from demon hosting. I have edited the script and the form works it sends me an...
2
by: sindhudixit | last post by:
Hey, I am having a user fill out a form then the fields are going to uploaded to my database. So, at this point, when the user hits the submit button I want three things to happen: 1. The...
0
by: gervo | last post by:
I have built a series of email forms in flash MX. using perl. the forms work for some people but not all and I was hoping some one could help me out. Here is the Actionscript on the send button ...
4
by: zufie | last post by:
I have a main form containing a command SEND button that prompts an email form to pop up. The email address(es) that are supposed to appear on the email form are those corresponding to the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.