Embed HTML table in email

Is it possible to send a table (encoded in html) as an email body so that the recipient can view the table (parsed and displayed).

For example, I want to send this as the body of the letter:

<html> <table> <tr> <td> col1 </td> <td> col2 </td> </tr> </table> </html> 

So that the recipient sees col1 col2 .

I read in some places that this is not possible, and that I should use the creator of the table provided by the email service, but I just wanted to confirm if this is possible or not.

+9
source share
5 answers

You can send an email with a table inside containing the data. Just make sure you style it as a "table containing data." Use this as an example.

This is if you create a letter.

 <html> <table width="600" style="border:1px solid #333"> <tr> <td align="center">head</td> </tr> <tr> <td align="center"> body <table align="center" width="300" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #ccc;"> <tr> <td> data </td> <td> info </td> </tr> </table> </td> </tr> </table> </html> 
+10
source

This will depend on the recipient's email client. Some appear in HTML, others only text.

+1
source

You can create a table in HTML, open it in a browser, and copy and paste it into Outlook (based on the additional information you provided in the comments).

Outlook will make sense of your HTML and provide in the same format in which you pasted it.

If the client uses only a text message (less likely at present with most smartphones that parse HTML email messages), it will look something like this:

 Header| Header 2 | Header 3 Test | test | Test Test | test | Test Test | test | Test 

No style.

+1
source

You cannot directly use the HTML or Body tag when embedding HTML in a C # line, since it will already be displayed inside the HTML page. Below is a simple table format.

  body += "<table align ='center'>" body += "<tr>" body += "<td align = 'right' > Name : </td>" body += "<td >" + Name + "</td>" body += "</tr>" body += "<tr>" body += "<td align = 'right' > Application ID :</td>" body += "<td >" + ApplicationID + "</td>" body += "</tr>" body += "<tr>" body += "<td align = 'right' > Passport No :</td>" body += "<td >" + PassportNo + " </td>" body += "</tr>" body += "<tr>" body += "<td align = 'right' > Voucher No. :</td>" body += "<td >" + VoucherNo + "</td>" body += "</tr>" body += "<tr>" body += "<td align = 'right' > Date : </td>" body += "<td >" + PDate + "</td>" body += "</tr>" body += "</table><br>" 

You can also make a style as below

Example

 body+="<td style='padding:10px; height:20px; width=200px'>Hello World!</td>" 
+1
source

A few years ago, I discovered that you can insert a table into the body of an email when using Thunderbird. Since then, I switched to a fool. So, out of curiosity, I created a html table using latex2html on a simple latex table. Then I opened the Mutt editor to create an email, copied and pasted the HTML code into the Mutt editor, and closed it to go to the Mutt creation menu. Before sending the email, I used Ctrl-t to edit the content type and change it from "text / plain" to "text / html". After sending the email and opening it in gmail in the browser, the table looked exactly as I would like.

Thus, in the end, you can insert the HTML table into the Mutt editor (in my case vim) and just change the type of content before sending.

0
source

Source: https://habr.com/ru/post/888947/


All Articles