Jelajahi Sumber

add trial information into welcome email

Son NK 5 tahun lalu
induk
melakukan
01abc48f62

+ 1 - 1
app/auth/views/activate.py

@@ -41,7 +41,7 @@ def activate():
     user = activation_code.user
     user.activated = True
     login_user(user)
-    email_utils.send_welcome_email(user.email, user.name)
+    email_utils.send_welcome_email(user)
 
     # activation code is to be used only once
     ActivationCode.delete(activation_code.id)

+ 1 - 1
app/auth/views/facebook.py

@@ -130,7 +130,7 @@ def facebook_callback():
 
         db.session.commit()
         login_user(user)
-        email_utils.send_welcome_email(user.email, user.name)
+        email_utils.send_welcome_email(user)
 
         flash(f"Welcome to SimpleLogin {user.name}!", "success")
 

+ 1 - 1
app/auth/views/github.py

@@ -101,7 +101,7 @@ def github_callback():
         )
         db.session.commit()
         login_user(user)
-        email_utils.send_welcome_email(user.email, user.name)
+        email_utils.send_welcome_email(user)
 
         flash(f"Welcome to SimpleLogin {user.name}!", "success")
 

+ 1 - 1
app/auth/views/google.py

@@ -115,7 +115,7 @@ def google_callback():
 
         db.session.commit()
         login_user(user)
-        email_utils.send_welcome_email(user.email, user.name)
+        email_utils.send_welcome_email(user)
 
         flash(f"Welcome to SimpleLogin {user.name}!", "success")
 

+ 5 - 5
app/email_utils.py

@@ -29,12 +29,12 @@ def _render(template_name, **kwargs) -> str:
     return template.render(**kwargs)
 
 
-def send_welcome_email(email, name):
+def send_welcome_email(user):
     send_email(
-        email,
-        f"Welcome to SimpleLogin {name}!",
-        _render("welcome.txt", name=name),
-        _render("welcome.html", name=name),
+        user.email,
+        f"Welcome to SimpleLogin {user.name}",
+        _render("welcome.txt", name=user.name, user=user),
+        _render("welcome.html", name=user.name, user=user),
     )
 
 

+ 2 - 1
shell.py

@@ -36,6 +36,7 @@ app = create_app()
 with app.app_context():
     # to test email template
     # with open("/tmp/email.html", "w") as f:
-    #     f.write(_render("welcome.html", name="John Wick"))
+    #     user = User.get(1)
+    #     f.write(_render("welcome.html", user=user, name=user.name))
 
     embed()

+ 7 - 3
templates/emails/welcome.html

@@ -11,12 +11,16 @@
 
   {{ render_text('To better secure your account, I recommend enabling Multi-Factor Authentication (MFA) on your <a href="https://app.simplelogin.io/dashboard/setting">Setting page</a>.') }}
 
-  {{ render_text('If you use Chrome or Firefox, SimpleLogin extension could be handy to quickly create aliases. Chrome extension can be installed on <a href="https://chrome.google.com/webstore/detail/simplelogin-your-anti-spa/dphilobhebphkdjbpfohgikllaljmgbn">Chrome Store</a> and Firefox on <a href="https://addons.mozilla.org/en-GB/firefox/addon/simplelogin/">Firefox Store</a>.') }}
+  {{ render_text('SimpleLogin browser extension could be handy to quickly manage aliases. Chrome (or other Chromium-based browsers like Brave or Vivaldi) extension can be installed on <a href="https://chrome.google.com/webstore/detail/simplelogin-your-anti-spa/dphilobhebphkdjbpfohgikllaljmgbn">Chrome Store</a>, Firefox on <a href="https://addons.mozilla.org/en-GB/firefox/addon/simplelogin/">Firefox Store</a> and Safari on <a href="https://apps.apple.com/us/app/simplelogin/id1494051017?mt=12&fbclid=IwAR0M0nnEKgoieMkmx91TSXrtcScj7GouqRxGgXeJz2un_5ydhIKlbAI79Io">AppStore</a>.') }}
 
   {{ render_text('If you have a domain, for example for your business or your project, you can import your domain into SimpleLogin
-and create your business emails backed by your personal email. This is cheaper and more convenient than buying a GSuite account. By the way, all our business emails are actually aliases :).') }}
+and create your <b>business emails</b> using email alias. This is cheaper and more convenient than buying a dedicated solution like GSuite. By the way, all our business emails are actually aliases.') }}
 
-  {{ render_text('Importing domain is only available for Premium plan though, shoot me an email by replying to this email if you need a trial period.') }}
+  {% if user.in_trial() %}
+  {{ render_text('You can use all premium features like <em>custom domain</em> or <em>alias directory</em> during the <b>trial period</b>. Your trial will end ' + user.trial_end.humanize() + ".") }}
+  {% endif %}
+
+  {{ render_text('If there\'s anything that\'s bugging you, even the smallest of issues that could be done better, I want to hear about it - so hit the reply button.') }}
 
 {% endblock %}
 

+ 16 - 5
templates/emails/welcome.txt

@@ -5,16 +5,27 @@ My name is Son. I’m the founder of SimpleLogin and I wanted to be the first to
 To better secure your account, I recommend enabling Multi-Factor Authentication (MFA) on your setting page at
 https://app.simplelogin.io/dashboard/setting
 
-If you use Chrome or Firefox, SimpleLogin extension could be quite handy to quickly create aliases.
-You can install Chrome extension on
+SimpleLogin browser extension could be handy to quickly manage aliases.
+
+Chrome (or other Chromium-based browsers like Brave or Vivaldi) extension can be installed on:
 https://chrome.google.com/webstore/detail/simplelogin-your-anti-spa/dphilobhebphkdjbpfohgikllaljmgbn
 
-and Firefox on
+Firefox on
 https://addons.mozilla.org/en-GB/firefox/addon/simplelogin/
 
+and Safari on
+https://apps.apple.com/us/app/simplelogin/id1494051017?mt=12&fbclid=IwAR0M0nnEKgoieMkmx91TSXrtcScj7GouqRxGgXeJz2un_5ydhIKlbAI79Io
+
 If you have a domain, for example for your business or your project, you can import your domain into SimpleLogin
-and create your business emails backed by your personal email! By the way, all our business emails are actually aliases 🤫.
-Importing domain is only available for Premium plan though, shoot me an email if you need a trial period.
+and create your business emails backed by your personal email! By the way, all our business emails are actually aliases.
+
+{% if user.in_trial() %}
+You can use all premium features like custom domain or alias directory during the trial period.
+Your trial will end {{ user.trial_end.humanize() }}.
+{% endif %}
+
+If there's anything that's bugging you, even the smallest of issues that could be done better, I want to hear about it - so hit the reply button.
+
 
 Thanks.
 Son - SimpleLogin founder.

+ 1 - 1
templates/header.html

@@ -26,7 +26,7 @@
               </span>
 
               {% if current_user.in_trial() %}
-                <small class="text-success d-block mt-1">Trial ends in {{ current_user.trial_end|dt }}</small>
+                <small class="text-success d-block mt-1">Trial ends {{ current_user.trial_end|dt }}</small>
               {% elif current_user.lifetime_or_active_subscription() %}
                 <small class="text-success d-block mt-1">Premium</small>
               {% endif %}