diff --git a/app/config.py b/app/config.py index 1b4ba037..bb5bef5d 100644 --- a/app/config.py +++ b/app/config.py @@ -195,6 +195,7 @@ FLASK_PROFILER_PASSWORD = os.environ.get("FLASK_PROFILER_PASSWORD") # Job names JOB_ONBOARDING_1 = "onboarding-1" JOB_ONBOARDING_2 = "onboarding-2" +JOB_ONBOARDING_3 = "onboarding-3" # for pagination PAGE_LIMIT = 20 diff --git a/app/models.py b/app/models.py index e3aa4edd..0068e986 100644 --- a/app/models.py +++ b/app/models.py @@ -18,6 +18,7 @@ from app.config import ( AVATAR_URL_EXPIRATION, JOB_ONBOARDING_1, JOB_ONBOARDING_2, + JOB_ONBOARDING_3, ) from app.extensions import db from app.log import LOG @@ -175,6 +176,11 @@ class User(db.Model, ModelMixin, UserMixin): payload={"user_id": user.id}, run_at=arrow.now().shift(days=2), ) + Job.create( + name=JOB_ONBOARDING_3, + payload={"user_id": user.id}, + run_at=arrow.now().shift(days=3), + ) db.session.flush() return user diff --git a/job_runner.py b/job_runner.py index f6703780..d7a89908 100644 --- a/job_runner.py +++ b/job_runner.py @@ -6,7 +6,7 @@ import time import arrow -from app.config import JOB_ONBOARDING_1, JOB_ONBOARDING_2 +from app.config import JOB_ONBOARDING_1, JOB_ONBOARDING_2, JOB_ONBOARDING_3 from app.email_utils import send_email, render from app.extensions import db from app.log import LOG @@ -42,12 +42,21 @@ def onboarding_send_from_alias(user): def onboarding_pgp(user): send_email( user.email, - f"Do you know you can encrypt your emails so only you can read them", + f"Do you know you can encrypt your emails so only you can read them?", render("com/onboarding/pgp.txt", user=user), render("com/onboarding/pgp.html", user=user), ) +def onboarding_mailbox(user): + send_email( + user.email, + f"Do you know SimpleLogin can manage several email addresses?", + render("com/onboarding/mailbox.txt", user=user), + render("com/onboarding/mailbox.html", user=user), + ) + + if __name__ == "__main__": while True: # run a job 1h earlier or later is not a big deal ... @@ -84,6 +93,15 @@ if __name__ == "__main__": if user and user.notification and user.activated: LOG.d("send onboarding pgp email to user %s", user) onboarding_pgp(user) + elif job.name == JOB_ONBOARDING_3: + user_id = job.payload.get("user_id") + user = User.get(user_id) + + # user might delete their account in the meantime + # or disable the notification + if user and user.notification and user.activated: + LOG.d("send onboarding mailbox email to user %s", user) + onboarding_mailbox(user) else: LOG.error("Unknown job name %s", job.name) diff --git a/templates/emails/com/onboarding/mailbox.html b/templates/emails/com/onboarding/mailbox.html new file mode 100644 index 00000000..073e054a --- /dev/null +++ b/templates/emails/com/onboarding/mailbox.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} + +{% block content %} + {{ render_text("Hi " + user.name) }} + {{ render_text("If you have several email addresses, e.g. Gmail for work and Protonmail for personal stuffs, you can add them into SimpleLogin and create aliases for them.") }} + + {{ render_text("A real email address is called mailbox in SimpleLogin.") }} + + Mailbox Gmail + Mailbox Protonmail + + {{ render_text("When creating an alias, you can choose which mailbox that owns this alias, meaning:") }} + + {{ render_text("1. Emails sent to this alias are *forwarded* to the owning mailbox.") }} + + {{ render_text("2. The owning mailbox can *send* or reply emails from this alias.") }} + + {{ render_text("You can also change the owning mailbox for an existing alias.") }} + + {{ render_text('The mailbox doesn\'t have to be your personal email: you can also create aliases for your friend by adding his/her email as a mailbox.') }} + + {{ render_button("Create mailbox", "https://app.simplelogin.io/dashboard/mailbox") }} + + {{ render_text('Thanks,
SimpleLogin Team.') }} + {{ render_text('P.S. Need immediate help getting started? Just reply to this email, the SimpleLogin support team is always ready to help!.') }} + + {{ raw_url("https://app.simplelogin.io/dashboard/mailbox") }} + +{% endblock %} + +{% block footer %} + This email is sent to {{ user.email }} and is part of our onboarding series. Unsubscribe on + Settings +{% endblock %} diff --git a/templates/emails/com/onboarding/mailbox.txt b/templates/emails/com/onboarding/mailbox.txt new file mode 100644 index 00000000..88589294 --- /dev/null +++ b/templates/emails/com/onboarding/mailbox.txt @@ -0,0 +1,26 @@ +This email is sent to {{ user.email }} and is part of our onboarding series. +Unsubscribe from our emails on https://app.simplelogin.io/dashboard/setting#notification +---------------- + +Hi {{user.name}} + +If you have several email addresses, e.g. Gmail for work and Protonmail for personal stuffs, you can add them into SimpleLogin and create aliases for them. + +A (real) email address is called *mailbox* in SimpleLogin. + +When creating an alias, you can choose which mailbox that *owns* this alias, meaning: + +- emails sent to this alias are *forwarded* to the owning mailbox. + +- the owning mailbox can *send* or reply emails from this alias. + +You can also change the owning mailbox for an existing alias. + +The mailbox doesn't have to be your personal email: you can also create aliases for your friend by adding his/her email as a mailbox. + +Start create you mailbox on https://app.simplelogin.io/dashboard/mailbox + +As usual, let us know if you have any question by replying to this email. + +Best regards, +SimpleLogin team. \ No newline at end of file