Strapi V4 电子邮件模板和 css 样式在发送邮件和接收邮件后未考虑

Strapi V4 email template and css style not taken into account after sending mail and at receiving it

提问人:Quentin Genet 提问时间:7/7/2023 最后编辑:Quentin Genet 更新时间:7/7/2023 访问量:198

问:

我正在尝试从我创建的电子邮件模板 Strapi V4 发送电子邮件。

邮件发送得很好,我收到也很好,但是尽管我的 html 文件中有内联 css 样式,但在发送邮件时似乎没有考虑到它,因为当我收到它时,与我的 html 电子邮件模板相比,结果并不好......

我尝试内联使用css:它不起作用。我尝试在同一个 html 文件中使用类和标签的 css,但它也不起作用...... 有没有解决方案可以考虑我对此电子邮件模板的 css 样式?

如果我从计算机上的 localhost 检查我的 html 文件,它可以工作,但在发送电子邮件后收到它时就不能了。

只需低沉我的代码(我故意将 html 文件中的一些个人信息替换为“已删除”......

<div style="max-width: 800px; display: flex; flex-direction: column; justify-content: center; text-align: center; align-content: center;">
<img style="width: 100%;" src="deleted">
<p style="text-align: left; color: hsl(0, 0%, 60%)">
    COMMANDE #&lt;%= deleted.deleted.ref %&gt;
</p>
<h2>Merciiiii et bienvenue dans la team deleted!</h2>
<br>
<p>
    Hey &lt;%= deleted.deleted.firstname %&gt;, nous avons bien reçu votre commande et nous vous en remercions vivement ! Elle est actuellement en cours de préparation par la team logistique !
</p>
<p>
    On vous tient au courant dès qu'elle est en route !
</p>
<p>
    Pour rappel, voici les prochaines étapes pour accéder à deleted:
</p>
<br>
<img style="width: 80%; margin-left: 50px" src="https://deleted.fr/">
<table style="table-layout: fixed; width: 100%;">
    <tbody>
        <tr style="display: flex; flex-direction: row;">
            <td style="flex: 1 1 auto; display:flex; flex-direction: column; justify-content: center;">
                <span style="text-align: center; max-width: 200px;">Votre commande a été prise en compte et sera bientôt expédiée par notre équipe !</span>
            </td>
            <td style="flex: 1 1 auto; display:flex; flex-direction: column; justify-content: center;">
                <span style="text-align: center; max-width: 200px;">Votre commande est en livraison. Elle sera prochainement entre vos mains</span>
            </td>
            <td style="flex: 1 1 auto; display:flex; flex-direction: column; justify-content: center;">
                <span style="text-align: center; max-width: 200px;">C'est arrivé ! Vous pouvez maintenant en profiter en vous connectant sur le site grâce au code d'identification à l'intérieur</span>
            </td>
        </tr>
    </tbody>
</table>
<table style="table-layout: fixed; width: 100%;">
    <tbody>
        <tr style="display: flex; flex-direction: row; justify-content: center;">
            <td style="justify-content: center; text-align: center; align-items: center;">
                <a style="text-decoration: none;" href="<%= deleted.deleted.invoice %>"><img src="https://deleted.fr/deleted-" alt="Checkez votre commande"></a>
            </td>
        </tr>
    </tbody>
</table>
<p>
    Résumé de votre commande : 
</p>
<table style="table-layout: fixed; width: 100%;">
    <tbody>
        <tr style="display: flex;">
            <td>
                <img style="max-width: 100px; max-height: 100px; margin-left: 15px; margin-right: 15px;" src="https://deleted.fr/deleted">
            </td>
            <td style="flex: 1 1 auto;">
                <span>deleted, votre guide et accompagnement grossesse</span>
                <br>
                <span>X&lt;%= deleted.deleted.quantity %&gt;</span>
            </td>
        </tr>
        <tr style="display: flex;">
            <td style="flex: 1 1 auto;">
            </td>
            <td>
                &lt;%= deleted.deleted.amount %&gt;€
            </td>
        </tr>
    </tbody>
</table>
<hr>
<table style="table-layout: fixed; width: 100%;">
    <tbody>
        <tr style="display: flex;">
            <td style="flex: 1 1 auto;">
                <span>Sous-total</span>
            </td>
            <td>
                &lt;%= deleted.deleted.amount %&gt;€
            </td>
        </tr>
        <tr style="display: flex; margin: 30px 0px 10px 0px;">
            <td style="flex: 1 1 auto;">
                <span>Expédition</span>
            </td>
            <td style="flex: 1 1 auto;">
                <span></span>
            </td>
            <td>
                0,00€
            </td>
        </tr>
        <tr style="display: flex;">
            <td>
                <span>Total</span>
            </td>
            <td style="flex: 1 1 auto;">
                <span></span>
            </td>
            <td>
                &lt;%= deleted.deleted.amount %&gt;€
            </td>
        </tr>
    </tbody>
</table>
<p style="text-align: left">
<br>
Cordialement,
<br>
<span style="color: #e7a6ca">
    <strong>L'équipe deleted</strong>
</span>
</p>
<p style="text-align: center">
<br><span style="color: hsl(0, 0%, 60%)">------ NE PAS REPONDRE A CE MAIL ------</span><br><span style="color: hsl(0, 0%, 60%)">Cet email a été envoyé depuis le site&nbsp;</span><a href="https://www.deleted.fr"><span style="color: hsl(0, 0%, 60%)">https://www.deleted.fr</span></a><br>&nbsp;
</p>
css html-email strapi 电子邮件模板

评论

0赞 Quentin Genet 7/7/2023
好吧,我认为我应该避免像 flexbox 这样的复杂 CSS 和像 margin : 0 10px 这样的速记符号;也许我应该使用更多的表格单元格 (<td>) 和表格行 (<tr>)。
1赞 LS_ 7/7/2023
电子邮件中的 CSS 是有限的,您可以使用来检查客户端是否支持属性。
0赞 Quentin Genet 7/7/2023
@LS_ 感谢网络链接,非常有用!事实上,我已经找到了一个解决方案,而无需使用 flexbox 并且仅使用基本的 html 和 css 属性,并且它有效......我会尽快为社区分享我的代码,以防它可以帮助处于相同情况的人......

答: 暂无答案