html - bootstrap 4 css 不适用于烧瓶中的邮件 html 模板
问题描述
所以我有这个 html 模板,我用它作为邮件模板来发送我的用户以重置他们的密码。我想bootstrap 4 classes
在模板中使用,但它不起作用。我如何使这项工作?我试过inline css
了,效果很好,但我想使用bootstrap 4 css
. 任何帮助,将不胜感激。
HTML 模板
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}}</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css2?family=Poppins&family=Rubik:wght@300&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="text-center">
<h2>Have you just requested for the password reset !</h2>
<a href="#" class="btn btn-outline-success">Reset Password</a>
</div>
</div>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" charset="utf-8"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" charset="utf-8"></script>
</body>
</html>
烧瓶代码
@app.route('/forget', methods=['GET', 'POST'])
def forget_password():
form = ForgetPassword()
if request.method == 'GET':
return render_template("forget.html", title="Forget Password", form=form)
email = request.form['email']
session['email'] = email
token = s.dumps(email, salt='reset-password')
msg = Message("Password Reset", sender="bookverm1999@gmail.com", recipients=[email])
link = url_for("reset_pass", token=token, _external=True)
msg.body = "Password Reset Link"
msg.html = render_template("mail.html", link=link, title="Password Reset")
mail.send(msg)
return render_template("sent.html", title="Email Sent")
解决方案
您只能使用内联 css,电子邮件不支持 css 链接,它仅受浏览器支持。我已经尝试使用我前一段时间创建的旧 css 来做到这一点,但我不得不将它嵌入到 html 中。
推荐阅读
- javascript - 如何使用发布请求更改文本?(角度)
- python - 用 $ 打印它,如使用 python 格式所示
- swiftui - SwiftUI 从 UIKit 获取数据到 SwiftUI
- java - 使用 Sping Boot 的 Power BI SSO
- html - 使用 Angular 美化 XML
- vue.js - 我不想在 API 通信期间关闭模式
- json - 将多个 JSON 加载到 SQL 表
- function - 如何在 Python 中将函数连接到 PyQT5 GUI
- excel - 申请后没有反应的Bug
- jupyter-notebook - 使用 conda 将 jupyter notebook 升级到 6.0.2