c# winforms multiline textbox to mailto: body

273 Views Asked by At

I have tried to find an answer to this particular question, and I've tried replacing all \r\n with <br> but it didn't work. I might be doing something wrong though.

What I want is to get a multiline textbox's content into a mail body after the user clicks on a button.

This is an example of what my textbox result is vs how it comes out in the mail body:

Multiline textbox content in my program:
MVT
6B123/26/SERNC.LAX
AD1445/1447 EA1913 LPA
PX328

Mailto body:

MVT6B123/26/SERNC.LAXAD1445/1447EA1913LPAPX328

I've tried this with .Text.Replace too but it didn't work with <br> as in my example here below (to be fair I'm pretty new to coding).

string mailResult = txtMvtResult.Text.Replace("\r\n", "<br>");
string command = "mailto:[email protected]?subject=MVT&body=" + mailResult + "";
System.Diagnostics.Process.Start(command);

Does anyone know how I can make my mail body look like a multiline textbox's content?

Best regards, Rickard

0

There are 0 best solutions below