0

在我的 Jhipster 应用程序中,当我创建新用户时,它会发送电子邮件以重置密码,用户会收到电子邮件,但我想在该电子邮件中显示一张图像,这样看起来不错

我已经在 ActivationEmail.html 中编写了填充行来添加图像,但是当用户没有在电子邮件中获得图像时。

<img th:src="@{|${https://crunchbase-production-res.cloudinary.com/image/upload/c_lpad,h_256,w_256,f_auto,q_auto:eco/v1484233225}/vexdy5hgzgljw17nums1.png|}" alt="Mountain View" style="width:150px;height:100px"></img>

请帮助我并建议我使用电子邮件添加图像的正确代码?

4

2 回答 2

1

通过用户管理页面创建用户使用creationEmail.html模板。通过注册页面注册使用activationEmail.html模板。

您可以使用常规图像标签在您的 JHipster 电子邮件模板中添加图像:

<img src="https://jonathanturley.files.wordpress.com/2017/06/images.png" height="100" width="150" />

例如,图像应显示在电子邮件中,如下图所示:

带有嵌入图像的电子邮件

于 2018-03-16T14:40:56.423 回答
0
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    <head>
        <title th:text="#{email.activation.title}">JHipster activation</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="shortcut icon" th:href="@{|${baseUrl}/favicon.ico|}" />
    </head>
    <body>
         <img src="https://jonathanturley.files.wordpress.com/2017/06/images.png" height="100" width="150" />

         <p th:text="#{email.activation.greeting(${user.login})}">
            Dear
        </p>
        <p th:text="#{email.activation.text1}">
            Your JHipster account has been created, please click on the URL below to activate it:
        </p>
        <p>
            <a th:href="@{|${baseUrl}/#/activate?key=${user.activationKey}|}"
               th:text="@{|${baseUrl}/#/activate?key=${user.activationKey}|}">Activation Link</a>
        </p>
        <p>
            <span th:text="#{email.activation.text2}">Regards, </span>
            <br/>
            <em th:text="#{email.signature}">JHipster.</em>
        </p>
    </body>
</html>
于 2018-03-17T14:55:53.327 回答