BR tag doesn't work in php emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • venkat1
    New Member
    • Oct 2007
    • 2

    BR tag doesn't work in php emails

    i have sent a form to my email using mail() in php , in that i have used <br /> to get the feilds data in list format . but im getting the <br /> as well with the message and im not getting the format that i wanted. what's wrong?
  • JeremyMiller
    New Member
    • Sep 2007
    • 69

    #2
    Sounds like you're sending in text-only mode. To send as HTML, use the HTML example on php.net: http://us2.php.net/manual/en/function.mail.p hp#id3111223

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Welcome to TSDN!

      As the previous post stated you are probably running text.
      But when that is your intention you must use newlines to break a line, so you'd insert [php]"\n\r"[/php] (within double quotes!) instead of the <br>.

      Ronald

      Comment

      • JeremyMiller
        New Member
        • Sep 2007
        • 69

        #4
        I think there are issues doing the \n\r in that order. Most of the time systems will use and expect \r\n

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Correct JeremyMiller, first the carriage return, then the newline.

          Ronald

          Comment

          • venkat1
            New Member
            • Oct 2007
            • 2

            #6
            sorr! guys i'm not getting ,can u people plz explain me little bit more abt the <br />

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              Originally posted by venkat1
              sorr! guys i'm not getting ,can u people plz explain me little bit more abt the <br />
              The carriage return (CR) is a special code (ASCII value 13) that moves the screen cursor or a print head to the beginning of the current line. Most word processors and the MS-DOS operating system use a combination of CR and line feed (LF – ASCII value 10) to represent a hard return. The Unix system, however, uses only LF and therefore files transferred between MS-DOS and Unix require a conversion program.
              So this is for text-only, like in a text area, editor, a text file, etc.

              The <br> tag is a HTML tags and is is used when you want to end a line in a HTML display, but don't want to start a new paragraph. The <br> tag forces a HTML line break wherever you place it.
              This is used when displaying text in a HTML document.

              In your case, an text-only e-mail message is treated as plain text, i.e. you use the markup for text data such as carriage return and line feed.
              When your e-mail message is sent as HTML, you use the <br> to break a line in the output.

              Ronald

              Comment

              Working...