C# Send Outlook Email with Multiple Lines
<p>My code allows a user to type into a Text Box and send their message to another user using Outlook. The program works perfectly fine except if the user types something with multiple lines it is opened in outlook as a single line.</p>

<p>For example:</p>

<p>"Hello John,</p>

<p>How are you today?</p>

<p>Sincerely, Mark"</p>

<p>Will be displayed as "Hello John, How are you today? Sincerely, Mark"</p>

<p>How am I able to get these messages sent with the correct spacing?</p>

<p>The code for my text box is:</p>

<pre><code>&lt;asp:TextBox ID="txtMessage" runat="server" placeholder="Please Enter Your Message Here." rows="18" style="width:100%; margin-top:20px; margin-bottom:20px" TextMode="MultiLine" MaxLength="9999" /&gt;
</code></pre>

<p>The code for my email function is:</p>

<pre><code>using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;
using Outlook = Microsoft.Office.Interop.Outlook;


namespace Cards
{
    public partial class _Message : _Default
    {
        //Declaring global variables for the email function to be used in this class.
        protected string toEmail, emailSubj, emailMsg;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (lblName.Text == null) return;
            lblUserId.Text = Session["userid"].ToString();
            lblName.Text = Session["name"].ToString();
            lblBirth.Text = Session["birth"].ToString();
            lblEmail.Text = Session["email"].ToString();
            lblHire.Text = Session["hire"].ToString();

        }

         protected void btnSend_Click(object sender, EventArgs e)
        {
        //Calling the parts to construct the email being sent
            toEmail = lblEmail.Text;
            emailSubj = "It's Your Special Day";
            emailMsg = txtMessage.Text;

            SendMail(toEmail, emailSubj, emailMsg);
            MessageBox.Show("Successfully sent message to " + lblName.Text, "Message Sent!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Response.Redirect("~/Default.aspx");
        }

        private static void SendMail(string toEmail, string subj, string message)
        {
            //This class will call all parts to the email functionality and generate the constructors for the email messsage.
            try
            {
                // Create the Outlook application.
                Outlook.Application oApp = new Outlook.Application();
                // Create a new mail item.
                Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
                //Add the body of the email
                oMsg.HTMLBody = message;
                //Subject line
                oMsg.Subject = subj;
                // Add a recipient.
                Outlook.Recipients oRecips = oMsg.Recipients;
                // Change the recipient in the next line if necessary.
                Outlook.Recipient oRecip = oRecips.Add(toEmail);
                oRecip.Resolve();
                // Send.
                oMsg.Send();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error has occurred. Please report this error to the Development team",
                    "Error found!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }
}
</code></pre>