在电子邮件中嵌入 HTML 表格
是否可以将表格(以 html 编码)作为电子邮件正文发送,以便收件人能够查看表格(解析并显示)。
例如,我希望能够将其作为电子邮件正文发送:
<html>
<table>
<tr>
<td> col1 </td>
<td> col2 </td>
</tr>
</table>
</html>
以便收件人看到 col1 col2
。
我在某些地方读到这是不可能的,并且我必须使用电子邮件服务提供的表创建器,但我只是想确认一下是否可能。
Is it possible to send a table (coded in html) as the body of an email so that the recipient is able to view the table (parsed and displayed).
For example, I want to be able to send this as the body of an email:
<html>
<table>
<tr>
<td> col1 </td>
<td> col2 </td>
</tr>
</table>
</html>
So that the recipient sees col1 col2
.
I've read in some places that it's not possible and that I must use the table creator provided by the email service, but I'd just like to confirm to see if it's possible or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(5)
您可以发送一封电子邮件,其中包含一个包含数据的
表格
。只需确保将其样式设置为“包含数据的表格”即可。以此为例。这是如果您正在构建电子邮件。
You can send an email with a
table
inside it containing data. Just make sure you style it as a 'table containing data'. Use this as an example.This is if you are building an email.
这将取决于收件人的电子邮件客户端。有些以 HTML 格式显示,有些则仅显示纯文本。
This will depend on the recipient's email client. Some display in HTML, others only display plain text.
在
c#
字符串中嵌入 HTML 时,不能直接使用HTML
或Body
标记,因为它已经显示在HTML页面。下面是一个简单的表格格式。
一样进行样式设置
您还可以像下面的示例
You can not directly use
HTML
orBody
tag when you embedding HTML inc#
string as it already going to display insideHTML
Page. Below is a simple table format.You can also do styling like below
Example
您可以用 HTML 创建表格,在浏览器中将其打开,然后复制并复制该表格。将其粘贴到 Outlook 中(根据您在评论中提供的额外信息)
Outlook 将理解您的 HTML,并以与您粘贴的格式相同的格式提供。
如果客户端使用纯文本电子邮件(现在不太可能 - 大多数智能手机都解析 HTML 电子邮件),那么它只会以类似的方式显示:
没有任何样式。
You can create the table in HTML, open it up in a browser and copy & paste it into Outlook (based on the extra information you've provided in comments)
Outlook will make sense of your HTML, and provide in the same format as you pasted it.
If the client is using a text only e-mail (less likely nowadays - with most smartphones parsing HTML emails) then it will just appear a similar way to:
Without any styling.
几年前,我发现使用 Thunderbird 时可以在电子邮件正文中插入表格。从那时起我就改用mutt了。因此,出于好奇,我在一个简单的 Latex 表格上使用 Latex2html 创建了一个 html 表格。然后,我打开 mutt 编辑器创建一封电子邮件,并将 html 代码复制并粘贴到 mutt 编辑器中,然后关闭它以转到 mutt 撰写菜单。在发送电子邮件之前,我使用
Ctrl-t
编辑内容类型并将其从“text/plain”更改为“text/html”。发送电子邮件并在浏览器中的 Gmail 中打开它后,该表格的显示与我想要的完全一样。因此,总而言之,人们可以将 html 表格粘贴到 mutt 编辑器(在我的例子中是 vim)中,然后在发送之前更改内容类型。
Some years ago I found that you can insert a table in the email body when using Thunderbird. Since then I have switched to mutt. So, out of curiosity, I created a table in html by using latex2html on a simple latex table. I then opened the mutt editor to create an email and copied and pasted the html code into the mutt editor and closed it to go to the mutt compose menu. Before sending the email, I used
Ctrl-t
to edit the content type and change it from "text/plain" to "text/html". Upon sending the email and opening it in gmail in a browser, the table appeared exactly as I would have wanted.So, in summary, one can paste an html table into the mutt editor (vim, in my case) and just change the content type before sending it.