We help IT Professionals succeed at work.
Get Started

How to stop my mail.asp script from removing whitespace.

Letterpart
Letterpart asked
on
501 Views
Last Modified: 2012-05-08
Hi,

I am so far out of my comfort zone with ASP that I don't even know where to start and am looking for some expert help please.

I have an asp script that my host gave me for mailing a web form. It all works except it strips all the whitespace from between the form contents.

I have attached the form code and mail.asp.

thanks for your help.


HTML FORM:

div id="contact_form"> 
  <form name="contact" action="">

    <fieldset>
    <!-- Name-->
      <label for="name" id="name_label">* Name</label>
      <input type="text" name="name" id="name" size="35" value="" class="text-input" />
      <label class="error" for="name" id="name_error">This field is required.</label>
          <!-- Email-->
      <label for="email" id="email_label">* Email</label>

      <input type="text" name="email" id="email" size="35" value="" class="text-input" />
      <label class="error" for="email" id="email_error">This field is required.</label>
          <!-- Phone-->
      <label for="phone" id="phone_label">* Phone</label>
      <input type="text" name="phone" id="phone" size="35" value="" class="text-input" />
      <label class="error" for="phone" id="phone_error">This field is required.</label>
          <!-- Enquiry-->

      <label for="enquiry" id="enquiry_label">* Enquiry</label>
      <textarea name="enquiry" id="enquiry" cols="27" rows="5" class="text-input"></textarea>
      <label class="error" for="enquiry" id="enquiry_error">This field is required.</label>
      <br />
      <input type="submit" name="submit" class="button" id="submit_btn" value="Send" />
    </fieldset>
    
  </form>

</div>  


mail.asp script: 

<%
        'Create an instance of our ASPEMail object.
        Set mailObj = Server.CreateObject("Persits.MailSender")

        'Configure our test email.
        mailObj.Host = "localhost"
		mailObj.From = Request("email")
		mailObj.FromName = Request("name")

        mailObj.Subject = "Web Contact form"
        mailObj.Body = "Dear Hedley," & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "The following form information has been submitted:
" & Chr(13) & Chr(10) & Chr(13) & Chr(10)
& "Name: " & mailObj.FromName & Chr(13)
& Chr(10) & "Telephone: " & Request("phone")
& Chr(13) & Chr(10) & "Email: " & Request("email")
& Chr(13) & Chr(10) & "Enquiry: " & Request("enquiry")

        'Add a recipient address.
        mailObj.AddAddress "me@mydomain.com", "Target Person"

        'We need to catch the error.
        On Error Resume Next
        mailObj.Send
        If (Err <> 0) Then
            Response.Write "There was an error sending the email: " & Err.Description
        End If
    %>

Open in new window

Comment
Watch Question
Senior Solution Architect
Commented:
This problem has been solved!
Unlock 5 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE