email - Formatting a plain text e-mail in C# -


I am trying to print a table within an e-mail using plain text. I have the following code:

  string body = String.Format ("{0, -30} {1, -30} {2, -50} {3, -40}", " Col1 "," Col2 "," Col2 "," Col4 "); Body = = String.Format ("{0, -30} {1, -30} {2, -50} {3, -40}", value1, value2, value3, VALUE4); Microsoft.Office.Interop.Outlook.ApplicationClass myOutlookApplication = null; MyOutlookApplication = New Microsoft.Office.Interop.Outlook.ApplicationClass (); Microsoft.Office.Interop.Outlook.MailItem myNewMail = (Microsoft.Office.Interop.Outlook.MailItem) myOutlookApplication.CreateItem (Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); MyNewMail.To = Recipient; MyNewMail.Subject = Topic; MyNewMail.Body = Body; MyNewMail.BodyFormat = OlBodyFormat.olFormatPlain; MyNewMail.Send ();  

The problem I have is that there is no text line for the body, it wraps the text inside the mail. Can anyone tell me what I can be doing wrong here?

After

Creating (or actually copying the behavior of) a table works in plain text only well When:

  1. The values ​​in your tables are exactly the same width as the widht of the column. It is you should take care of (programmer) following the text with some spaces when the text is too small or by cutting the text if it is too long.

  2. The user receiving the text is using a monospace font () to view the table. And it is unfortunately beyond your control if you send the table in the e-mail message ...


Comments