使文本可以在HTML电子邮件中轻松复制,而无需额外的空白字符

时间:2015-11-05 17:35:48

标签: html email twig html-email

我无法为用户格式化密码重置电子邮件,以便可以轻松复制密码而无需任何额外字符,空白或其他字符。

到目前为止,我已尝试过以下格式。我使用TWIG,如果您不熟悉双花括号内的所有内容都是变量。在这些括号内不计入空格。

尝试1

You requested a password reset for your account {{ user.username }}.
<br /><br />
Your password has been reset to: {{ password }}
<br />
<br />
Please keep track of your new password and follow <a href="{{ url('index') }}">this link to login</a>

尝试2

You requested a password reset for your account {{ user.username }}.
<br /><br />
Your password has been reset to:
<br />
<table>
    <tr>
        <td>{{ password }}</td>
    </tr>
</table>
</br />
Please keep track of your new password and follow <a href="{{ url('index') }}">this link to login</a>

在这两种情况下,我在复制后粘贴密码时会得到一个额外的空白字符。

1 个答案:

答案 0 :(得分:1)

尝试将BR直接放在密码后面,而不是放在下一行:

… {{ password }}<br>

大概是白色空间(换行符)在复制和粘贴值时会造成麻烦。