fix: 邮件格式

This commit is contained in:
shaohuzhang1 2023-12-20 14:57:45 +08:00
parent b61da14fdd
commit 81df321782
2 changed files with 117 additions and 45 deletions

View File

@ -1,42 +1,114 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="email code"> <meta name="description" content="email code" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1" />
</head> </head>
<!--邮箱验证码模板--> <!--邮箱验证码模板-->
<body> <body>
<div style="background-color:#ECECEC; padding: 35px;"> <div style="background-color: #ececec; padding: 35px">
<table cellpadding="0" align="center" <table
style="width: 800px;height: 100%; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;"> cellpadding="0"
style="
width: 800px;
height: 100%;
margin: 0px auto;
text-align: left;
position: relative;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
font-size: 14px;
font-family: 微软雅黑, 黑体;
line-height: 1.5;
box-shadow: rgb(153, 153, 153) 0px 0px 5px;
border-collapse: collapse;
background-position: initial initial;
background-repeat: initial initial;
background: #fff;
"
>
<tbody> <tbody>
<tr> <tr>
<th valign="middle" <th
style="height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgba(51, 112, 255); background-color: rgba(51, 112, 255); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;"> valign="middle"
<font face="微软雅黑" size="5" style="color: rgb(255, 255, 255); ">智能客服平台验证码</font> style="
background: linear-gradient(
90deg,
#ebf1ff 24.34%,
#e5fbf8 56.18%,
#f2ebfe 90.18%
);
height: 25px;
line-height: 25px;
padding: 15px 35px;
border-bottom-width: 1px;
border-bottom-color: rgba(51, 112, 255);
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
"
>
<div
style="
width: 230px;
background: linear-gradient(180deg, #3370ff 0%, #7f3bf5 100%);
-webkit-background-clip: text;
font-size: 24px;
-webkit-text-fill-color: transparent;
font-family: Arial Black;
font-style: normal;
font-weight: 900;
color: #1f2329;
"
>
MaxKB 智能知识库
</div>
</th> </th>
</tr> </tr>
<tr> <tr>
<td style="word-break: break-all"> <td style="word-break: break-all">
<div style="padding:25px 35px 40px; background-color:#fff;opacity:0.8;"> <div
style="
<h2 style="margin: 5px 0px; "> padding: 25px 35px 40px;
<font color="#333333" style="line-height: 20px; "> background-color: #fff;
<font style="line-height: 22px; " size="4"> opacity: 0.8;
尊敬的用户:</font> "
>
<h2 style="margin: 5px 0px">
<font color="#333333" style="line-height: 20px">
<font style="line-height: 22px" size="4">
尊敬的用户:</font
>
</font> </font>
</h2> </h2>
<!-- 中文 --> <!-- 中文 -->
<p><font color="#ff8c00" style="font-weight: 900;">${code}</font>&nbsp;&nbsp;为您的动态验证码请于30分钟内填写为保障帐户安全请勿向任何人提供此验证码。 <p>
</p><br> <font color="#ff8c00" style="font-weight: 900">${code}</font
>&nbsp;&nbsp;为您的动态验证码请于30分钟内填写为保障帐户安全请勿向任何人提供此验证码。
</p>
<br />
<div style="width:100%;margin:0 auto;"> <div style="width: 100%; margin: 0 auto">
<div style="padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;text-align:right"> <div
<p>飞致云</p> style="
<br> padding: 10px 10px 0;
<p>此为系统邮件,请勿回复<br> border-top: 1px solid #ccc;
color: #747474;
margin-bottom: 20px;
line-height: 1.3em;
font-size: 12px;
text-align: right;
"
>
<p>飞致云 - MaxKB 项目组</p>
<br />
<p>
此为系统邮件,请勿回复<br />
Please do not reply to this system email Please do not reply to this system email
</p> </p>
<!--<p>©***</p>--> <!--<p>©***</p>-->

View File

@ -321,7 +321,7 @@ class SendEmailSerializer(ApiMixin, serializers.Serializer):
user_cache.set(code_cache_key_lock, code, timeout=datetime.timedelta(minutes=1)) user_cache.set(code_cache_key_lock, code, timeout=datetime.timedelta(minutes=1))
try: try:
# 发送邮件 # 发送邮件
send_mail(f'智能客服{"用户注册" if state == "register" else "修改密码"}', send_mail(f'MaxKB 智能知识库-{"用户注册" if state == "register" else "修改密码"}',
'', '',
html_message=f'{content.replace("${code}", code)}', html_message=f'{content.replace("${code}", code)}',
from_email=EMAIL_ADDRESS, from_email=EMAIL_ADDRESS,