How to make a line break to send an email to a user with HTML? [duplicate]

0

I send an email to the user who signs in to the application. I'd like to know how to do the line break so that it stays the way I want it to. Here is the code I use:

private void newUserEmail(string email, string sexo, string usuario)
        {
            String strResult, strURL;
            string conteudo;
            strURL = "http://app.com.br/email_template/padrao.html";
            WebResponse objResponse;
            WebRequest objRequest = HttpWebRequest.Create(strURL);
            objResponse = objRequest.GetResponse();
            using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
            {
                strResult = sr.ReadToEnd();
                sr.Close();
            }

            string subject = null;
            if (sexo.Equals("F"))
            {
                subject = "Bem Vinda!";
                conteudo = "<b>Bem Vinda!! "+usuario+ "</b>";/*string.Format(" /*string.Format("<b>Bem Vindo, " + usuario + "!<b>{0}" +
                    "<b>Linha 2:{1}" +
                    "1. Linha 3.{2}" +
                    "2. Linha 4.{3}" +
                    "3. Linha 5.{4}", Environment.NewLine);*/
            }
            else
            {
                subject = "Bem Vindo!";
                conteudo = "<b>Bem Vindo! " + usuario+ "</b>";/*string.Format("<b>Bem Vinda, " + usuario + "!<b>{0}" +
                    "<b>Linha 2:{1}" +
                    "1. Linha 3.{2}" +
                    "2. Linha 4.{3}" +
                    "3. Linha 5.{4}", Environment.NewLine);*/
            }

            string html = strResult;

            string body = html.Replace("{{{CONTEUDO}}}", conteudo);
            SendEmail.SendMessage(email, body, subject);
        }

The commented lines were what they had tried to do, but to no avail. Thank you.

    
asked by anonymous 29.05.2017 / 15:19

2 answers

4

Only use the HTML line wrap tag <br> .

conteudo = "Linha 1<br>Linha 2<br>Linha 3<br>";
    
29.05.2017 / 15:22
2

Uses <br> same as html

"<b>Linha 2:{1}<br/>" +
"1. Linha 3.{2}<br/>" +
"2. Linha 4.{3}<br/>" +
"3. Linha 5.{4}", Environment.NewLine);
    
29.05.2017 / 15:25