电子邮件模板预包装在Outlook中不起作用

问题描述 投票:0回答:1

我正在渲染一个html电子邮件模板,并且我有一个要显示的预包装文本。

使用white-space: pre-wrap;可以在Outlook以外的所有地方(gmail,yahoo ...)完美运行。我尝试使用<pre>/<pre>在所有地方(gmail,yahoo甚至Outlook桌面应用程序)也都可以完美使用,但是在Outlook Web应用程序中无法使用。

任何建议我接下来应该尝试什么?

代码示例1:

<td style="color: #153643; font-family: Arial, sans-serif; font-size: 24px;"> <div style="white-space: pre-wrap; text-align: left; font-weight: bold" th:text="${content}"></div> </td>

代码示例2:

<td style="color: #153643; font-family: Arial, sans-serif; font-size: 24px;"> <pre style="text-align: left; font-weight: bold" th:text="${content}"></pre> </td>

email thymeleaf html-email
1个回答
0
投票

最好的前进方式可能就是使用Outlook条件代码,即:

<td style="color: #153643; font-family: Arial, sans-serif; font-size: 24px;">
    <!--[if !mso]><!-- --><div style="white-space: pre-wrap; text-align: left; font-weight: bold" th:text="${content}"></div><!--<![endif]-->
    <!--[if mso]><!-- --><pre style="text-align: left; font-weight: bold" th:text="${content}"></pre><!--<![endif]-->
</td>
© www.soinside.com 2019 - 2024. All rights reserved.