Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I get the email to have line feeds. It currently runs together.

ASP.NET
<% Const SECTION = 17 %> <% Const SECTION_NAME = "internet" %>

<% 
submitted = request("submitted")
if submitted = "true" then
  ACC = request("ACC")
  FirstName = request("FirstName")
  LastName = request("LastName")
  Mailing1 = request("Mailing1")
  Mailing2 = request("Mailing2")
  Phone = request("Phone")
  Email = request("Email")
  GCScreenName = request("GCScreenName")
  GCRegistrationType = request("GCRegistrationType")
  eCScreenName = request("eCScreenName")
  eCRegistrationType = request("eCRegistrationType")
  'everything is required, make sure nothing is blank
  if ACC = "" or FirstName = "" or LastName = "" or Mailing1 = "" or Mailing2 = "" or Phone = "" or Email = "" or GCScreenName = "" or GCRegistrationType = "" or eCScreenName = "" or eCRegistrationType = "" then
    if ACC = "" then
      errorMessage = "ACC Number is required."
    elseif FirstName = "" then
      errorMessage = "First Name is required."
    elseif LastName = "" then
      errorMessage = "Last Name is required."
    elseif Mailing1 = "" then
      errorMessage = "Street Address is required."
    elseif Mailing2 = "" then
      errorMessage = "City/State is required."
    elseif Phone = "" then
      errorMessage = "Phone Number is required."
    elseif Email = "" then
      errorMessage = "Email is required."
    elseif GCScreenName = "" then
      errorMessage = "GameColony Screen Name is required."
    elseif GCRegistrationType = "" then
      errorMessage = "GameColony Registration Type is required."
    elseif eCScreenName = "" then
      errorMessage = "eCribbage Screen Name is required."
    elseif eCRegistrationType = "" then
      errorMessage = "eCribbage Registration Type is required."
    end if
  else
    mailfrom = request("email")
    mailto = "xxxxxxx@gmail.com;xxxxxxxx@hotmail.com"  
    mailsubject = "ACC Internet Program - Screen Name Registration"
    mailtext = "ACC:" & ACC & ",FirstName:" & FirstName & ",LastName:" & LastName & ",Mailing1:" & Mailing1 & ",Mailing2:" & Mailing2 & ",Phone:" & Phone & ",Email:" & Email & ",GCScreenName:" & GCScreenName & ",GCRegistrationType:" & GCRegistrationType & ",eCScreenName:" & eCScreenName & ",eCRegistrationType:" & eCRegistrationType
    Set objNewMail = CreateObject("CDONTS.NewMail")
    ObjNewMail.Send mailfrom, mailto, mailsubject, mailtext
  end if
end if
%>


What I have tried:

I was told it is in classic asp. Everything I've tried still gives email when received all one line instead of each item of the form on a new line.
Posted
Updated 17-Nov-16 15:49pm

1 solution

It's pretty obvious. You need to insert return/linefeed characters at appropriate points inside mailtext. They don't appear by magic. See the RFC here https://tools.ietf.org/html/rfc2822#section-2.3
 
Share this answer
 
Comments
Member 12857039 20-Nov-16 21:37pm    
Inserted the CFLF as such: mailtext = "ACC:" & ACC & "CRLF,FirstName:" & FirstName & "CRLF

and the email added the letters CRLF in the text and still no line feeds.
Peter_in_2780 21-Nov-16 0:38am    
You don't want to insert the string "CRLF", but rather the characters representing return ( \r, 0x0d, char(13) ) and linefeed ( \n, 0x0a, char(10) ). There may be predefined literal constants you can use.
Member 12857039 23-Nov-16 13:28pm    
Where in the code do you insert your reply? Every place I've tried I either get a 500 error or the message that comes out has the string in the text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900