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,52 +1,124 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="email code">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<!--邮箱验证码模板-->
<body>
<div style="background-color:#ECECEC; padding: 35px;">
<table cellpadding="0" align="center"
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;">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="email code" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<!--邮箱验证码模板-->
<body>
<div style="background-color: #ececec; padding: 35px">
<table
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>
<tr>
<th valign="middle"
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;">
<font face="微软雅黑" size="5" style="color: rgb(255, 255, 255); ">智能客服平台验证码</font>
<tr>
<th
valign="middle"
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>
</tr>
<tr>
<td style="word-break:break-all">
<div style="padding:25px 35px 40px; background-color:#fff;opacity:0.8;">
</tr>
<tr>
<td style="word-break: break-all">
<div
style="
padding: 25px 35px 40px;
background-color: #fff;
opacity: 0.8;
"
>
<h2 style="margin: 5px 0px">
<font color="#333333" style="line-height: 20px">
<font style="line-height: 22px" size="4">
尊敬的用户:</font
>
</font>
</h2>
<!-- 中文 -->
<p>
<font color="#ff8c00" style="font-weight: 900">${code}</font
>&nbsp;&nbsp;为您的动态验证码请于30分钟内填写为保障帐户安全请勿向任何人提供此验证码。
</p>
<br />
<h2 style="margin: 5px 0px; ">
<font color="#333333" style="line-height: 20px; ">
<font style="line-height: 22px; " size="4">
尊敬的用户:</font>
</font>
</h2>
<!-- 中文 -->
<p><font color="#ff8c00" style="font-weight: 900;">${code}</font>&nbsp;&nbsp;为您的动态验证码请于30分钟内填写为保障帐户安全请勿向任何人提供此验证码。
</p><br>
<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">
<p>飞致云</p>
<br>
<p>此为系统邮件,请勿回复<br>
Please do not reply to this system email
</p>
<!--<p>©***</p>-->
</div>
</div>
<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;
"
>
<p>飞致云 - MaxKB 项目组</p>
<br />
<p>
此为系统邮件,请勿回复<br />
Please do not reply to this system email
</p>
<!--<p>©***</p>-->
</div>
</div>
</div>
</td>
</tr>
</tr>
</tbody>
</table>
</div>
</body>
</html>
</table>
</div>
</body>
</html>

View File

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