When I try to create the email body from my C# program some funny things happen
oItem.Body = text;
oItem
is a Microsoft.Office.Interop.Outlook.MailItem
and text
is just an ordinary string containing \n
When I do this, the \n
gets translated into \r\n
. The problem is that some of the \n
get translated into \r\n\r\n
and I cannot figure out why or when. The content of text
comes from different sources but it is just a normal string, like in the example below
text: "Zusammenfassung:\nText0\nText1 \n\nText2\nText3\nText4 {...} TextX\n
oItem.Body: "Zusammenfassung: \r\nText0 \r\nText1 \r\n\r\nText2\r\n\r\nText3\r\n\r\nText4 {...} TextX\r\n
What is happening there? I'm totally confused.
edit: the double newline is created when the string is build with +=
string lineToSend = "bla Bla: " + Sig + " bla bla " + string.Join(", ", usedCnt.toCntName());
if (refCnts.Count() != 0)
{
lineToSend += "some Text";
}
else
{
lineToSend += " some other Text";
}
//lineToSend = "dummyStringLine";
messageObj.setMessageLines(lineToSend);
If i use the dummyStringLine everything is fine.