简体   繁体   English

在C#中以纯文本电子邮件格式化表格

[英]Formatting a table in a plain text email in C#

I'm trying to send data in a tabular format via email and I was just told that some of our clients can't receive HTML formatted emails, which is what I was using. 我正试图通过电子邮件以表格格式发送数据,我只是被告知我们的一些客户端无法接收HTML格式的电子邮件,这正是我所使用的。 I tried to manage this using tabs, but the length of the strings varied too much to make this reasonable. 我尝试使用制表符管理它,但字符串的长度变化太大,以使这个合理。

Is there a way to easily format tabular data in a plain text email? 有没有办法轻松格式化纯文本电子邮件中的表格数据?

I don't think you're going to find anything broadly reliable - you'll fall over the following: 我不认为你会找到任何广泛可靠的东西 - 你会摔倒在下面:

  • Lots of people read email in proportional fonts, so padding with spaces doesn't work 很多人用比例字体读取电子邮件,因此使用空格填充不起作用
  • Email clients don't agree about rendering tabs so you can't use them even without your char spacing problem. 电子邮件客户端不同意渲染选项卡,因此即使没有char间距问题也无法使用它们。

What about sending a PDF attachment? 发送PDF附件怎么样? I know there will be angry purists madly down-voting me for daring to suggest it, but it could free you up from an endless unsatisfactory fights with mailers. 我知道会有愤怒的纯粹主义者疯狂地向我投票,因为我敢于暗示它,但它可以让你从与邮寄者无休止的不满意的战斗中解脱出来。

You could try to use a '-' to fill in the white space. 您可以尝试使用“ - ”填充空白区域。 It won't be perfect but it might work better than a tab or a space. 它不会是完美的,但它可能比标签或空间更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM