Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    96

    Unanswered: Replacing carriage return by BR tag before to send an email

    Hi,
    I have a text area on page 1 which is use for the body of the email sent on page 2
    On page 2 i collect the data entered by the user (ASP Javascript), replace teh carriage returns by a BR tag and send the email.
    The carriage returns seem to be replaced fine when checking on a page, however on the email where the BR tag should be it is not adding a break line, as well as that it is removing part of the text sent, can't figure it out.
    I am using Jmail to send the email set as text/html
    Here is the code i use to replace the \n:
    // replace CR/LFs with BRs
    function ReplaceCRLF(str) {
    re = /\n/g;
    return str.replace(re,"<BR>");
    }


    Thanking you for any help

    Oli

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    And you are encoding the entire email with <html> and <body> tags?
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Aug 2004
    Posts
    96
    Yes the entire email contains body tags and the all lot, i am just incorporating the data coming from the form in a p tag

  4. #4
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    I'd bet that your <BR> tag is not actually being replaced. I'd use the Replace function of ASP to replace the carriage return and line feed, not JavaScript.

    myVar = Replace(Request.Form("textField"), vbCRLF, "<BR>")
    That which does not kill me postpones the inevitable.

Posting Permissions

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