简体   繁体   English

在通过 Sendgrid 的 API 发送的 html email 中的动态文本中添加换行符

[英]Add line breaks to dynamic text in an html email sent via Sendgrid's API

I am inserting dynamic text in my HTML email that has got numbering and subsequent line breaks.我在我的 HTML email 中插入动态文本,该文本具有编号和后续换行符。 The SendGrid tag is: {{insert emailData.data.copy3 'default=' }} The text I am inserting looks like this: SendGrid 标记是: {{insert emailData.data.copy3 'default=' }}我插入的文本如下所示:

The attached proposal covers the following:
 
1. Overview
2. How the Fund contributes to systemic change

Please indicate  your acceptance by clicking on this button

However, it is displaying like this in my email:但是,它在我的 email 中显示如下:

The attached proposal covers the following: 1. Overview 2. How the Fund contributes to systemic change Please indicate  your acceptance by clicking on this button

Please assist so that my line breaks displays correctly.请协助,以便我的换行符正确显示。

In HTML whitespace, beyond spaces between words, is ignored by rendering engines.在 HTML 中,超出单词之间的空格的空格被渲染引擎忽略。 You need to lay out your document with HTML to make it render correctly.您需要使用 HTML 布置文档以使其正确呈现。

In the case of your email copy, to make it appear like you wish, you need to include HTML to lay it out.对于您的 email 副本,要使其看起来像您希望的那样,您需要包含 HTML 以进行布局。 This should work:这应该有效:

<p>The attached proposal covers the following:
<ol>
  <li>Overview</li>
  <li>How the Fund contributes to systemic change</li>
</ol>
<p>Please indicate your acceptance by clicking on this button</p>

How you generate this HTML is up to you.如何生成此 HTML 取决于您。 You could, for example, run your original text through a markdown parser and generate the HTML from that text.例如,您可以通过 markdown 解析器运行您的原始文本,并从该文本生成 HTML。

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

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