[Last Call] Learn how to a build a cloud-first strategyRegister Now


Line feed in text email using content of asp text box

Posted on 2009-12-21
Medium Priority
Last Modified: 2012-08-14
I'm trying to send the content from an asp:TextBox multi line  to a text email via the mailto: function. (Client needs to edit the email before sending- that's why I'm using mailto:)
The text shows up OK in the Textbox on the web form when I use "\r\n". There is a javascript function that pulls the content from that box and adds it to an email and when the email pops up, the linefeeds and even the spaces are removed. How can I keep that from happening. Client doesn't want an html email. Here is the javacript function (code I found somewhere)
  function checkForm() {
        var emailContentText = document.getElementById("<%=VendorContentText.ClientID %>").value;
            var c1 = "mailto:orders@xxx.com?&subject='NewOrders'&body=Note: " + emailContentText + "%0D%0A";
            (window.location ? window.location.replace(c1) : document.write(c1))
If I copy the text from the text box into Notepad++, it shows the spaces and linefeeds.

Question by:jmestep

Accepted Solution

uk44 earned 1400 total points
ID: 26098095
You could try escaping the email content for URL posting - eg emailContentText becomes escape(emailContentText)  in c1

Author Closing Comment

ID: 31668550

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question