Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 28th, 2005, 04:45 AM
smokingmirror smokingmirror is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 smokingmirror User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 48 sec
Reputation Power: 0
Email Body Text - Help!

Ok, firstly thanks to everyone who looks at this thread and posts, as I'm finding solving my current problem not only tricky, but extremely irritating.

Basically, I am tweaking the website for the company where I work and am trying to grab information from a form which potential customers fill out, then email those fields to our email address.

The form has been written, and works fine. I've also written the script to grab the info and email it, which runs fine...

...my problem lies with tweaking the body text to include headers which will help those who receive the emails ascertain to which field the information that has been mailed is taken (currently the form information is simply listed in the email, with a line break between each section. So, for example, the first line shows whatever the customer filled out in the 'Name' field on the form, but nothing to indicate to the email reader that that is the name field).

Incidentally, please disregard the strange field names. They are all correct, and do work, they are just thus named due to me being lazy and simply copy/pasting new fields in, rather than naming each one.



My script, which grabs from the form, is as follows. This script works perfectly, I just don't know how to add indications into the body text as to which bit of information belongs to which field.

<% @LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>


<p>
<%

Set Mail = Server.CreateObject("SMTPsvg.Mailer") 'create an Asp mail component.
Mail.FromName = Request.Form ("email")
Mail.FromAddress = Request.Form ("email3")
Mail.RemoteHost = "mrvnet.kundenserver.de" ' The mail server you have to use with Asp Mail
Mail.AddRecipient "US", "OUREMAIL@OURDOMAIN.com"
Mail.Subject = "Customer Request"
Mail.BodyText = Request.Form("email") & vbcrlf & Request.Form("email2") & vbcrlf & Request.Form("email4") & vbcrlf & Request.Form("email5") & vbcrlf & Request.Form("email6") & vbcrlf & Request.Form("email7") & vbcrlf & Request.Form("email72") & vbcrlf & Request.Form("email73") & vbcrlf & Request.Form("email732") & vbcrlf & Request.Form("email7322") & vbcrlf & Request.Form("email733") & vbcrlf & Request.Form("info")
if Mail.SendMail then
Response.Redirect("thankyou.asp")
else
Response.Write "Mail send failure. Error was " & Mail.Response
end if
Set Mail = Nothing


%>
</p>
<p>&nbsp;</p>
</body>

</html>

Reply With Quote
  #2  
Old June 28th, 2005, 07:36 AM
mvagh2 mvagh2 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 324 mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 16 h 26 m 36 sec
Reputation Power: 5
Hi,

Maybe I misunderstand your problem completely, but can't you just do the following: -

Code:
Mail.BodyText = _
      "Kunde = " & Request.Form("email") & vbcrlf & _
      "Plz = " & Request.Form("email2") & vbcrlf & _
      "Ort = " & Request.Form("email4") 

and so on et cet era und so weiter

I think you could lookup the tags from the fields to make the script less hardcoded, but I'm not really in ASP/HTML/VB scripting, so you need advice from someone more knowledgeable than me.

If that's not the case, what are you trying to achieve??

Regards,

Michiel

Reply With Quote
  #3  
Old July 4th, 2005, 05:28 AM
smokingmirror smokingmirror is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 smokingmirror User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 48 sec
Reputation Power: 0
Firstly, mvagh2, thank you very much. My script to grab and email the form details now works!

I have one more question, though: some of the emails from the form are coming through without a line break between certain fields. Now the obvious answer is that the line break code doesn't exist for that line, but, er, it does.

My code has "<whatever the field is called> = " & Request.Form("<the field's ID>") & vbcrlf & _ for every single form box. What I don't understand is why some, not all, of the subsequent emails have the last four of five fields as being listed on one long line, instead of in seperate lines.

Reply With Quote
  #4  
Old July 5th, 2005, 08:06 AM
mvagh2 mvagh2 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 324 mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 16 h 26 m 36 sec
Reputation Power: 5
Hi,

1. You're welcome.
2. I don't know. However, personally when I encounter such an error, I double/triple/quadruple-check the spelling of vbcrlf. I misspell it all the time... But then again, not all emails suffer from the problem, as I understand - so that should rule out a typo.

Can't help you any further at this stage I'm afraid.

Good luck.

Michiel

Reply With Quote
  #5  
Old July 5th, 2005, 04:55 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
If your mail is in html you might need to add <br />
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #6  
Old July 8th, 2005, 07:32 AM
smokingmirror smokingmirror is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 8 smokingmirror User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 48 sec
Reputation Power: 0
I've checked my VB scripting and everything is fine. All the vbcrlf instances are correctly spelt, and, unfortunately, the script and page aren't HTML, so that rules out using a standard HTML break command...


...however, I've done a few tests and noticed something interesting:
I essentially filled my own form in 6 times, and each time put an extremely lengthy piece of information in a different field each time.

When the emails came through to my inbox, I noticed that each field was on its own seperate line, as it should be, but only up to the field that contained the long line of information. Everything after that suddenly lost all its line breaks and became one long string.

So, it looks like there is a limit in ASP mail VB scripting to the total length of characters one can include on a form if you still want the line break to occur.

I don't quite understand why this should be, but my tests have pretty conclusively proven it to be true.

So, um, any ideas how I can stop this?

Reply With Quote
  #7  
Old July 11th, 2005, 05:27 AM
mvagh2 mvagh2 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 324 mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level)mvagh2 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 16 h 26 m 36 sec
Reputation Power: 5
Hi,

No - not really. Maybe run a testscript generating a body with one char less each time it runs. That way determine the threshold for this whacky behaviour and have the page truncate the message based on that amount (or warn the user and not pass the message before he/she truncates it him-/herself).

Not much of a help actually.

Regards,

Michiel

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Email Body Text - Help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT