Email form and Netscape (?) or Win95

Results 1 to 3 of 3

Thread: Email form and Netscape (?) or Win95

  1. #1
    Kyle Parker Guest

    Default Email form and Netscape (?) or Win95

    On a web site I created a while back, I have a form visitors can fill out, which uses VBscript to email my account the submissions. The code I am using is below... Sometimes I receive blank email messages, no heading tags or anything. I have tested this on my machine (Win2k, IE 5.0 and Netscape 4.7) and if I leave all of the form fields blank, I receive a message similar to this:<BR><BR>name:<BR>email:<BR>branch:<BR>add_lin e1:<BR>add_line2:<BR>city:<BR>state:<BR>zip:<BR>bo dy:<BR><BR>This indicates the visitor did not fill out any of the information, they just clicked on Submit. However, I am also getting messages with nothing in them, as in no "name:," "email:" or "branch:" lines in the message. This leads me to believe that my code is not gathering all of the information properly and sending the email. <BR><BR>Here is the section of code I am using the send the email...<BR><BR>** story.asp ** <BR>.<BR>.<BR>.<BR>&#060;form method=post action=sendmail.asp name=InputForm&#062;<BR>.<BR>.<BR>.<BR><BR>** sendmail.asp ** <BR>&#060;%<BR> Dim strMessage<BR> <BR> &#039;* Package the information for the body of the message using the variable strMessage <BR> &#039;* and a For...Next loop to add each item passed from the form. <BR> <BR> For index=1 to Request.Form.Count<BR> If Request.Form.Key(index) &#060;&#062; "Submit" Then<BR> strMessage = strMessage & Request.Form.Key(index) & ": " & Request.Form.Item(index) & vbCrLf<BR> Else<BR> strMessage = strMessage<BR> End If<BR> Next<BR><BR> &#039;* Create the mail object and fill in the various fields<BR> &#039;* Check to ensure an email address was entered - if not, give it a dummy one <BR> <BR> If Request.Form("email") = "" Then<BR> strEmail = ""<BR> Else<BR> strEmail = Request.Form("email")<BR> End If<BR> <BR> Set objMail = CreateObject("CDONTS.Newmail")<BR> objMail.From = strEmail<BR> objMail.To = ""<BR> objMail.Subject = "World War II story submission"<BR> objMail.Body = strMessage<BR> objMail.BodyFormat = 0<BR> objMail.Send<BR> Set objMail = Nothing<BR>%&#062;<BR><BR>The Subject line and From fields come through ok, but there is nothing in the body of the message. I&#039;m not sure where the error lies. Unfortunately, I don&#039;t have enough boxes configured to check everything that comes to the site. On the day I received the last blank email, I was able to check the stats and found the user (I think it was the same one) visited the site using Win95, Netscape 4.x and JavaScript version 1.3. That is all of the information I was able to retrieve.<BR><BR>If someone could shed a little light on this, I would appreciate it. The information coming from the form is very important to me, and I would like to figure out a way to get it functional.<BR><BR>Thanks again,<BR>Kyle Parker<BR>Ball State University<BR>

  2. #2
    Join Date
    Dec 1969

    Default tut tut tut...

    University, huh? :)<BR><BR>You all intelligent and stuff then? :p<BR><BR>Ok, the thing which jumps out is you are iterating through the Request.Form collection. If you are getting a blank email, there&#039;s no information in the Request.Form collection.<BR><BR>Reason: The request method is not "post", it is instead "get". This can occur if a form references your page with the wrong method, or if the user hits the page BY JUST TYPING THE URL IN.<BR><BR>The latter is obviously the most obvious. You can use the Request.ServerVariables collection to find out the Request method. Test to see if the request method is "post". If it isn&#039;t, redirect to the form page.<BR><BR>Sound reasonable?! :)<BR><BR>Craig.

  3. #3
    Join Date
    Dec 1969

    Default RE: tut tut tut...

    Thanks - works great. Guess I need to go back to school.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts