diff --git a/server.py b/server.py index 0f0a32d9..9289e065 100644 --- a/server.py +++ b/server.py @@ -54,7 +54,7 @@ from app.config import ( from app.dashboard.base import dashboard_bp from app.developer.base import developer_bp from app.discover.base import discover_bp -from app.email_utils import send_email +from app.email_utils import send_email, render from app.extensions import db, login_manager, migrate, limiter from app.jose_utils import get_jwk_key from app.log import LOG @@ -571,11 +571,18 @@ def setup_paddle_callback(app: Flask): sub.cancelled = True db.session.commit() + user = sub.user + send_email( - ADMIN_EMAIL, - subject=f"{sub.user} cancels", - plaintext=f"{sub} {request.form.get('cancellation_effective_date')}", + user.email, + f"SimpleLogin - what can we do to improve the product?", + render( + "transactional/subscription-cancel.txt", + name=user.name or "", + end_date=request.form.get("cancellation_effective_date"), + ), ) + else: return "No such subscription", 400 elif request.form.get("alert_name") == "subscription_updated": diff --git a/templates/emails/transactional/subscription-cancel.txt b/templates/emails/transactional/subscription-cancel.txt new file mode 100644 index 00000000..1c0e6cb1 --- /dev/null +++ b/templates/emails/transactional/subscription-cancel.txt @@ -0,0 +1,16 @@ +Hi {{name}} + +This is Son, SimpleLogin founder. I saw that you have canceled your subscription. + +Your subscription will end at {{end_date}}. + +I would appreciate if you could tell me what we can do to improve the product or what is missing? + +Thanks for giving SimpleLogin a try! + +Best, +Son. + +----------------------------------------- +Son NK - SimpleLogin founder. +https://simplelogin.io \ No newline at end of file