我对flask-email非常陌生,现在我尝试发送html电子邮件,该电子邮件的图像位于模板主体内,但是当在电子邮件上打开此html时,该图像未显示,所以我该如何解决它。
这是我的示例代码。
msg = Message('Test', sender='sender_email', recipients=['receiver_email'])
msg.html=render_template('Email.html')
mail.send(msg)
return render_template('Email.html')
这是我在Email.html
中的img标签
<img src="{{ url_for('static', filename='images/logo.png', _external=True) }}">
答案 0 :(得分:2)
该网站上线了吗?如果不是,它将显示指向本地主机映像的链接,但是只有您可以在网络上打开它。这就是为什么您无法在电子邮件客户端中看到它的原因。将网站发布到服务器或域后,链接将公开,您将看到图像。