雅虎邮件客户端删除了锚标记中的 href

href in anchor tag is removed by yahoo mail client

下面是在邮件中发送的电子邮件模板片段代码:

<a href="https:&#x2F;&#x2F;someurl.net&#x2F;reset-password?passwordResetToken&#x3D;Qlc9CFIj8NziJEFuDFXv0uDHZTlzhMbj" style="font-family: 'arial',sans-serif; color: #fff; text-decoration: none; padding: 10px 10px;">TROQUE SUA SENHA</a>

yahoo 呈现类似 (missing href)

<a rel="nofollow" style="font-family:'arial', sans-serif;color:#fff;text-decoration:none;padding:10px 10px;">TROQUE SUA SENHA</a>

gmail 呈现类似(正确)

<a href="https://someurl.net/reset-password?passwordResetToken=OwNWeKbhoK8TaklFdJRIQWTi7dmCI93A" style="font-family:'arial',sans-serif;color:#fff;text-decoration:none;padding:10px 10px" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://someurl.net/reset-password?passwordResetToken%3DOwNWeKbhoK8TaklFdJRIQWTi7dmCI93A&amp;source=gmail&amp;ust=1588314607785000&amp;usg=AFQjCNEjn0R1PYzmZsDWVFxNzvIhjWG8_A">TROQUE SUA SENHA</a>

是否有任何特定的锚标记属性应该设置为在雅虎客户端中呈现 <a> 标记?

解决了,将 href url 中的 html entity hex&#x2F; 替换为 /

rawTemplate.replace(/&#x2F;/g, '/')

观察到 gmail 邮件客户端处理斜杠 (&#x2F;) 和斜杠 (/) 的 html 实体十六进制,因此能够得到正确的锚点 link 渲染后。

但是 yahoo 邮件客户端在呈现时只处理斜杠 (/),因此必须手动替换