Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Outlook email text ignores \r\n

Outlook email text ignores \r\n

Scheduled Pinned Locked Moved C#
help
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    George_Lucian
    wrote on last edited by
    #1

    Hi! I am trying to creat the body for an email. First I create the text of the email like this: System.Text.StringBuilder sbBody = new System.Text.StringBuilder(); sbBody.Append(" asdasfsdgfdfg dfgh \r\n"); sbBody.Append("fw4 34wtrc345v345345gv43bv3 \r\n"); sbBody.Append("asdasdaskjfn39i4fn3498gn4oegerlkg. \r\n"); Then I start a process that launches the email client. The problem is that the text of the email is not displayed correctly in Outlook, meaning that the \r\n are ignored(if I display the text in a message box the \r\n work fine). Can anyone help me with this problem... PS: I have tried using Convert.toChar(13) but still nothing...

    N G 2 Replies Last reply
    0
    • G George_Lucian

      Hi! I am trying to creat the body for an email. First I create the text of the email like this: System.Text.StringBuilder sbBody = new System.Text.StringBuilder(); sbBody.Append(" asdasfsdgfdfg dfgh \r\n"); sbBody.Append("fw4 34wtrc345v345345gv43bv3 \r\n"); sbBody.Append("asdasdaskjfn39i4fn3498gn4oegerlkg. \r\n"); Then I start a process that launches the email client. The problem is that the text of the email is not displayed correctly in Outlook, meaning that the \r\n are ignored(if I display the text in a message box the \r\n work fine). Can anyone help me with this problem... PS: I have tried using Convert.toChar(13) but still nothing...

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      If it's in HTML view, \r\n won't have any effect. You'd need a <br /> tag there instead.

      Regards, Nish


      Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
      C++/CLI in Action

      Fly on your way like an eagle Fly as high as the sun On your wings like an eagle Fly and touch the sun

      G 1 Reply Last reply
      0
      • N Nish Nishant

        If it's in HTML view, \r\n won't have any effect. You'd need a <br /> tag there instead.

        Regards, Nish


        Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
        C++/CLI in Action

        Fly on your way like an eagle Fly as high as the sun On your wings like an eagle Fly and touch the sun

        G Offline
        G Offline
        George_Lucian
        wrote on last edited by
        #3

        I have tried adding
        instead of \r\n...but in this case it just displays
        in the text...this means that it is not in HTML view mode

        1 Reply Last reply
        0
        • G George_Lucian

          Hi! I am trying to creat the body for an email. First I create the text of the email like this: System.Text.StringBuilder sbBody = new System.Text.StringBuilder(); sbBody.Append(" asdasfsdgfdfg dfgh \r\n"); sbBody.Append("fw4 34wtrc345v345345gv43bv3 \r\n"); sbBody.Append("asdasdaskjfn39i4fn3498gn4oegerlkg. \r\n"); Then I start a process that launches the email client. The problem is that the text of the email is not displayed correctly in Outlook, meaning that the \r\n are ignored(if I display the text in a message box the \r\n work fine). Can anyone help me with this problem... PS: I have tried using Convert.toChar(13) but still nothing...

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          How are you sending the mail body to the process?

          --- single minded; short sighted; long gone;

          G 1 Reply Last reply
          0
          • G Guffa

            How are you sending the mail body to the process?

            --- single minded; short sighted; long gone;

            G Offline
            G Offline
            George_Lucian
            wrote on last edited by
            #5

            strMail = "mailto:" + strAddress + "?subject=" + strSubj; strMail += "&body=" + sbBody.toString(); System.Diagnostics.Process.Start(strMail);

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups