I had an interesting bug today when sending plain text emails from our system. We format messages like this:

-1st something happened blab bla.  

-2nd something else happened blab blab blaa bla.  

Today we had an email that looked like this:

-1st something happened blab bla.  

-2nd something else happened blab blab blaa bla $1000.00 -3rd Something happened.  

So above, we see that we lost the CrLf but only on the message that didn't have a period and ended in 0. I went through the code and found the CrLf is intack up until we send the email. I tracked the code down below, I am guessing it applies to C# as well:  

*NOTE*: We use `Environment.NewLine` when building the string for the body.  

**Building the string:**

```
If Not errorList Is Nothing Then
    If errorList.Count > 0 Then
        strBldrBody.Append(EMailHelper.CrLf)
        strBldrBody.Append(EMailHelper.CrLf)
        strBldrBody.Append("Response Error List:")
        For Each itm As String In errorList
         strBldrBody.Append(EMailHelper.CrLf)
         strBldrBody.Append(DataHelper.DASH)
         strBldrBody.Append(itm)
        Next
    End If
End If

```

**Email encoding setting:**

```
Try
    If Not String.IsNullOrEmpty(recipient) Then
        Using mailMsg As MailMessage = New MailMessage()

            mailMsg.From = New MailAddress(_configHelper.EmailFrom)
            mailMsg.Subject = subject
            mailMsg.Body = body
            mailMsg.BodyEncoding = Encoding.UTF8

            EMailHelper.SetToAddress(recipient, mailMsg)   

            Dim smtpClient As SmtpClient = New SmtpClient(_configHelper.EmailRelayServer)

            smtpClient.Send(mailMsg)
        End Using
    End If

Catch ex As System.Exception
    'logs error
End Try

```

I want to know what happened in the string translation during the UTF-8 encoding/decoding that removes the CrLf?!

The problem was Outlook, see below:
[outlook screen shot](http://i.stack.imgur.com/PCGJa.png)