0 votes

As you format a text to send it by mail?

Very good afternoon, I'm wanting to send an email a few data that I get from a query on the database and what I have been doing with the code that I let down but what I need is to send as a table format but do not know how to set it up in C#.

textoCamIng += string.Format("Cliente: {0} {1} Segmento: {2} ", objCl.NroIdent, objCl.Nombre, rowC[6].ToString());
string res = email.Send(row[0].ToString(), new List<string> { correoSegAnt }, new List<string> { seg }, "Notificaciones CRM: Ingresosss", textoCamIng );

0voto

Leandro Tuttini Points 25288

If the variable mail is MailMessage then you have to define the property

MailMessage.IsBodyHtml Property

in true

To be able to use something like this

string template = @"<html>
                        <body>
                            <p><b>Cliente:</b> {0} {1} </p>
                            <p><b>Segmento:</b> {2}</p> 
                        </body>
                    </html>"

string textoCamIng = string.Format(template, objCl.NroIdent, objCl.Nombre, rowC[6].ToString());

email.IsBodyHtml = true;
string res = email.Send(row[0].ToString(), 
                        new List<string> { correoSegAnt }, 
                        new List<string> { seg }, 
                        "Notificaciones CRM: Ingresosss", 
                        textoCamIng );

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X