Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于邮件模板的调用问题 #75

Closed
GamerNoTitle opened this issue Jan 22, 2020 · 10 comments
Closed

关于邮件模板的调用问题 #75

GamerNoTitle opened this issue Jan 22, 2020 · 10 comments

Comments

@GamerNoTitle
Copy link

@GamerNoTitle GamerNoTitle commented Jan 22, 2020

我已经部署完了Valine-Admin,但是在给被at的人的邮件中出现了邮件模板调用的问题,我的邮件模板设定的是rainbow样式,但是当发送邮件给被at的人的时候,会调用leancloud里面重置密码的邮件模板,而不是调用变量中的模板,在valine的后台界面点重新发送通知邮件就会调用rainbow模板。
我想第一次给被at的人发邮件就直接发送rainbow模板,我需要怎么做?


下面是图
重置密码模板发出的邮件重置密码模板发出的邮件
rainbow模板发出的邮件rainbow模板发出的邮件
变量设置Var1
Var2


下面是代码
重置密码的邮件代码

<p>Hi, {{username}}</p>
<p>
你在 GamerNoTitle's Blog 的评论收到了新的回复,请点击查看:
</p>
<p><a href="http://bili33.top" style="display: inline-block; padding: 10px 20px; border-radius: 4px; background-color: #3090e4; color: #fff; text-decoration: none;">马上查看</a></p>

rainbow邮件模板

<div style="border-radius: 10px 10px 10px 10px;font-size:13px;    color: #555555;width: 666px;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;margin:50px auto;border:1px solid #eee;max-width:100%;background: #ffffff repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);"><div style="width:100%;background:#49BDAD;color:#ffffff;border-radius: 10px 10px 0 0;background-image: -moz-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));background-image: -webkit-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));height: 66px;"><p style="font-size:15px;word-break:break-all;padding: 23px 32px;margin:0;background-color: hsla(0,0%,100%,.4);border-radius: 10px 10px 0 0;">您在<a style="text-decoration:none;color: #ffffff;" href="${SITE_URL}"> ${SITE_NAME}</a>上的留言有新回复啦!</p></div><div style="margin:40px auto;width:90%"><p>${PARENT_NICK} 同学,您曾在文章上发表评论:</p><div style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">${PARENT_COMMENT}</div><p>${NICK} 给您的回复如下:</p><div style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">${COMMENT}</div><p>您可以点击<a style="text-decoration:none; color:#12addb" href="${POST_URL}#comments">查看回复的完整內容</a>,欢迎再次光临<a style="text-decoration:none; color:#12addb"                href="${SITE_URL}"> ${SITE_NAME}</a>。</p><style type="text/css">a:link{text-decoration:none}a:visited{text-decoration:none}a:hover{text-decoration:none}a:active{text-decoration:none}</style></div></div>
@tnrzy

This comment has been minimized.

Copy link

@tnrzy tnrzy commented Feb 6, 2020

@GamerNoTitle 你可能在博客 valine 设置选项notify值设为了 true( Valine 自带的邮件提醒,发送重置密码的邮件),它与 Valine-Admin 的邮件提醒是分开的,一起正常使用的话会给被@的人发送两封邮件,建议你把notify值设为 false ,把它关掉,也因为打开它默认启用 verify( Valine 自带的反人类算数验证码),如果你也打开了 verify ,那把它关了吧。

@GamerNoTitle

This comment has been minimized.

Copy link
Author

@GamerNoTitle GamerNoTitle commented Feb 6, 2020

@GamerNoTitle 你可能在博客 valine 设置选项notify值设为了 true( Valine 自带的邮件提醒,发送重置密码的邮件),它与 Valine-Admin 的邮件提醒是分开的,一起正常使用的话会给被@的人发送两封邮件,建议你把notify值设为 false ,把它关掉,也因为打开它默认启用 verify( Valine 自带的反人类算数验证码),如果你也打开了 verify ,那把它关了吧。

我把notify设置成了false,它的确不会按照重置密码的模板发送消息了,但是好像也没有立刻发送以rainbow为邮件模板的邮件

@GamerNoTitle

This comment has been minimized.

Copy link
Author

@GamerNoTitle GamerNoTitle commented Feb 6, 2020

在运行的日志里面发现有PARENT_NICK变量未指定的提示

[2020-02-06T09:44:12.096419321Z][instance:web1] LeanEngine: /Comment/afterSave: 500: ReferenceError: PARENT_NICK is not defined
[2020-02-06T09:44:12.096501573Z][instance:web1] at eval (eval at (/home/leanengine/app/utilities/send-mail.js:40:45), :1:1001)
[2020-02-06T09:44:12.096517476Z][instance:web1] at Object.exports.notice (/home/leanengine/app/utilities/send-mail.js:40:24)
[2020-02-06T09:44:12.096527911Z][instance:web1] at sendNotification (/home/leanengine/app/cloud.js:10:14)
[2020-02-06T09:44:12.096537551Z][instance:web1] at /home/leanengine/app/cloud.js:44:12
[2020-02-06T09:44:12.096546956Z][instance:web1] at err (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:368:23)
[2020-02-06T09:44:12.096556454Z][instance:web1] at promiseTry (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:366:10)
[2020-02-06T09:44:12.096586399Z][instance:web1] at Promise (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:253:7)
[2020-02-06T09:44:12.0965977Z][instance:web1] at callClassHook (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:241:10)
[2020-02-06T09:44:12.096607397Z][instance:web1] at promiseTry (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:104:16)
[2020-02-06T09:44:12.096616805Z][instance:web1] at err (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:368:23)
[2020-02-06T09:44:12.096626135Z][instance:web1] at promiseTry (/home/leanengine/app/node_modules/leanengine/lib/leanengine.js:366:10)
[2020-02-06T09:44:12.096635445Z][instance:web1] at /home/leanengine/app/node_modules/leanengine/lib/leanengine.js:86:5
[2020-02-06T09:44:12.0966447Z][instance:web1] at call (/home/leanengine/app/node_modules/connect/index.js:239:7)
[2020-02-06T09:44:12.096653751Z][instance:web1] at next (/home/leanengine/app/node_modules/connect/index.js:183:5)
[2020-02-06T09:44:12.096663111Z][instance:web1] at next (/home/leanengine/app/node_modules/connect/index.js:161:14)
[2020-02-06T09:44:12.096672383Z][instance:web1] at /home/leanengine/app/node_modules/leanengine/middleware/leancloud-headers.js:82:18

@tnrzy

This comment has been minimized.

Copy link

@tnrzy tnrzy commented Feb 6, 2020

@GamerNoTitle 请你把环境变量中的mail_template_admin的内容发给我看看

@tnrzy

This comment has been minimized.

Copy link

@tnrzy tnrzy commented Feb 6, 2020

顺便建议你再仔细看看教程 https://deserts.io/valine-admin-document/

@GamerNoTitle

This comment has been minimized.

Copy link
Author

@GamerNoTitle GamerNoTitle commented Feb 6, 2020

顺便建议你再仔细看看教程 https://deserts.io/valine-admin-document/

mail_template_admin的内容:

您在 ${SITE_NAME}上的留言有新回复啦!

${PARENT_NICK} 同学,您曾在文章上发表评论:

${PARENT_COMMENT}

${NICK} 给您的回复如下:

${COMMENT}

您可以点击查看回复的完整內容,欢迎再次光临 ${SITE_NAME}

<style type="text/css">a:link{text-decoration:none}a:visited{text-decoration:none}a:hover{text-decoration:none}a:active{text-decoration:none}</style>

我也再去看看教程OvO

@GamerNoTitle

This comment has been minimized.

Copy link
Author

@GamerNoTitle GamerNoTitle commented Feb 6, 2020

讲真,valine的算术验证是真的反人类T_T

@tnrzy

This comment has been minimized.

Copy link

@tnrzy tnrzy commented Feb 6, 2020

博主通知邮件模板中的可用变量与@通知中的基本一致,PARENT_NICK 和 PARENT_COMMENT 变量不再可用 by 教程

@GamerNoTitle

This comment has been minimized.

Copy link
Author

@GamerNoTitle GamerNoTitle commented Feb 6, 2020

博主通知邮件模板中的可用变量与@通知中的基本一致,PARENT_NICK 和 PARENT_COMMENT 变量不再可用 by 教程

明白,谢谢

我已经把notify调成了false,的确没有按照重置密码的模板发送了,但是它也没有立刻按照rainbow模板给我发送邮件呀

@GamerNoTitle

This comment has been minimized.

Copy link
Author

@GamerNoTitle GamerNoTitle commented Feb 6, 2020

我把云引擎重启以后他就好了,谢谢大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.