From 02e6bfd9fba0fb42c69ba3dfb2e6545aaf38dbc7 Mon Sep 17 00:00:00 2001 From: m4skedbyte <67880062+m4skedbyte@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:49:26 +0200 Subject: [PATCH 1/2] use html instead of body for html example --- docs/example.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/example.md b/docs/example.md index ac93c9a..812d669 100644 --- a/docs/example.md +++ b/docs/example.md @@ -65,7 +65,7 @@ async def html_email(): message = Message( subject="Flask-Mailing module test html mail", recipients=["aniketsarkar@yahoo.com"], - body=html, + html=html, subtype="html" ) From 5f92cdb372198c26e64bcba40a7380dcd9ab86a6 Mon Sep 17 00:00:00 2001 From: m4skedbyte <67880062+m4skedbyte@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:56:36 +0200 Subject: [PATCH 2/2] extend warning Extend warning to use `html` instead of `body` if sending a simple html message (subtype="html") --- flask_mailing/msg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_mailing/msg.py b/flask_mailing/msg.py index 97a7e46..5892dc9 100644 --- a/flask_mailing/msg.py +++ b/flask_mailing/msg.py @@ -103,7 +103,7 @@ async def _message(self, sender): if not self.html and self.subtype == "html": if self.body: warnings.warn( - "Use ``template_body`` instead of ``body`` to pass data into Jinja2 template", + "Use ``template_body`` instead of ``body`` to pass data into Jinja2 template. Use ``html`` instead of ``body`` to send a simple html message.", DeprecationWarning, ) self.message.attach(