在.NET中的字符串之间放置NewLines

She*_*ery 3 c#

我正在使用以下c#代码通过我的应用程序发送电子邮件

 myMail.Body = TextBox1.Text+
                      txtName.Text+
                      txtCName.Text+
                      txtAddress.Text+
                      TextBox1.Text+
                      txtCity.Text+
                      txtState.Text+
                      txtCountry.Text+
                      txtPhone.Text+
                      Fax.Text+
                      txtCell.Text+
                      txtEmail.Text+
                      txtPrinting.Text;
        myMail.BodyEncoding = System.Text.Encoding.UTF8;
Run Code Online (Sandbox Code Playgroud)

但我收到这种形式的邮件"sheerazahmedShehzoreHyderabadsheerazHyderabadSindhPakistan03453594552034598750258741sheery_1@hotmail.comsingle"即合并所有值,我希望textboxt的每个值在一个单独的新行,即

Sheeraz Ahmed
Shehzore
Hyderabad 
Run Code Online (Sandbox Code Playgroud)

等等

Vin*_*nzz 10

StringBuilder sb = new StringBuilder();

sb.AppendLine(TextBox1.Text);
sb.AppendLine(txtName.Text);
...


myMail.Body = sb.ToString();
Run Code Online (Sandbox Code Playgroud)


Zom*_*eep 7

myMail.Body = TextBox1.Text + Environment.NewLine + 
                  txtName.Text+ Environment.NewLine + 
                  txtCName.Text+ Environment.NewLine + 
                  txtAddress.Text+ Environment.NewLine + 
                  TextBox1.Text+ Environment.NewLine + 
                  txtCity.Text+ Environment.NewLine + 
                  txtState.Text+ Environment.NewLine + 
                  txtCountry.Text+ Environment.NewLine + 
                  txtPhone.Text+ Environment.NewLine + 
                  Fax.Text+ Environment.NewLine + 
                  txtCell.Text+ Environment.NewLine + 
                  txtEmail.Text+ Environment.NewLine + 
                  txtPrinting.Text;
    myMail.BodyEncoding = System.Text.Encoding.UTF8;
Run Code Online (Sandbox Code Playgroud)

或者更好的是,使用stringbuilder或string.Format

StringBuilder bodyBuilder = new StringBuilder("");
bodyBuilder .AppendLine(TextBox1.Text);
bodyBuilder .AppendLine(txtName.Text);
bodyBuilder .AppendLine(txtCName.Text);
bodyBuilder .AppendLine(txtAddress.Text);
  // etc.
myMail.Body = bodyBuilder .ToString();
Run Code Online (Sandbox Code Playgroud)

要么

myMail.Body = String.Format("{0}{1}{2}{1}{3}{1} ... ", TextBox1.Text, Environment.NewLine, txtCName.Text, txtAddress.Text -- etc...
Run Code Online (Sandbox Code Playgroud)