From 0c1eb13d93dfb4287623ae2542eb14411fb3ab2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 9 Jan 2023 10:13:54 +0100 Subject: [PATCH] fine tunings ;) --- lnbits/extensions/smtp/README.md | 16 +------- lnbits/extensions/smtp/smtp.py | 41 ++++++++----------- .../smtp/templates/smtp/_api_docs.html | 2 +- 3 files changed, 19 insertions(+), 40 deletions(-) diff --git a/lnbits/extensions/smtp/README.md b/lnbits/extensions/smtp/README.md index 339f210a6..5b7757e2f 100644 --- a/lnbits/extensions/smtp/README.md +++ b/lnbits/extensions/smtp/README.md @@ -9,18 +9,6 @@ This extension allows you to setup a smtp, to offer sending emails with it for a ## Usage 1. Create new emailaddress -2. Verify if email goes to your testemail. Testmail is send on create and update -3. enjoy +2. Verify if email goes to your testemail. Testmail is sent on create and update +3. Share the link with the email form. -## API Endpoints - -- **Emailaddresses** - - GET /api/v1/emailaddress - - POST /api/v1/emailaddress - - PUT /api/v1/emailaddress/ - - DELETE /api/v1/emailaddress/ -- **Emails** - - GET /api/v1/email - - POST /api/v1/email/ - - GET /api/v1/email/ - - DELETE /api/v1/email/ diff --git a/lnbits/extensions/smtp/smtp.py b/lnbits/extensions/smtp/smtp.py index a8830254d..e77bc0fa5 100644 --- a/lnbits/extensions/smtp/smtp.py +++ b/lnbits/extensions/smtp/smtp.py @@ -36,32 +36,23 @@ async def send_mail(emailaddress, email): msg["To"] = email.receiver signature = "Email sent anonymiously by LNbits Sendmail extension." - text = ( - """\ - """ - + email.message - + """ - """ - + signature - + """ - """ - ) + text = f""" +{email.message} + +{signature} +""" + + html = f""" + + + +

{email.message}

+
+

{signature}

+ + +""" - html = ( - """\ - - - -

""" - + email.message - + """

-


""" - + signature - + """

- - - """ - ) part1 = MIMEText(text, "plain") part2 = MIMEText(html, "html") msg.attach(part1) diff --git a/lnbits/extensions/smtp/templates/smtp/_api_docs.html b/lnbits/extensions/smtp/templates/smtp/_api_docs.html index c7ed44de8..cfb811d16 100644 --- a/lnbits/extensions/smtp/templates/smtp/_api_docs.html +++ b/lnbits/extensions/smtp/templates/smtp/_api_docs.html @@ -12,7 +12,7 @@

Charge people for using sending an email via your smtp server
More details