diff --git a/app/config.py b/app/config.py
index 95f8b111..1b4ba037 100644
--- a/app/config.py
+++ b/app/config.py
@@ -194,6 +194,7 @@ FLASK_PROFILER_PASSWORD = os.environ.get("FLASK_PROFILER_PASSWORD")
# Job names
JOB_ONBOARDING_1 = "onboarding-1"
+JOB_ONBOARDING_2 = "onboarding-2"
# for pagination
PAGE_LIMIT = 20
diff --git a/app/models.py b/app/models.py
index baa5333c..e3aa4edd 100644
--- a/app/models.py
+++ b/app/models.py
@@ -17,6 +17,7 @@ from app.config import (
URL,
AVATAR_URL_EXPIRATION,
JOB_ONBOARDING_1,
+ JOB_ONBOARDING_2,
)
from app.extensions import db
from app.log import LOG
@@ -169,6 +170,11 @@ class User(db.Model, ModelMixin, UserMixin):
payload={"user_id": user.id},
run_at=arrow.now().shift(days=1),
)
+ Job.create(
+ name=JOB_ONBOARDING_2,
+ payload={"user_id": user.id},
+ run_at=arrow.now().shift(days=2),
+ )
db.session.flush()
return user
diff --git a/job_runner.py b/job_runner.py
index b318bb0f..f6703780 100644
--- a/job_runner.py
+++ b/job_runner.py
@@ -6,7 +6,7 @@ import time
import arrow
-from app.config import JOB_ONBOARDING_1
+from app.config import JOB_ONBOARDING_1, JOB_ONBOARDING_2
from app.email_utils import send_email, render
from app.extensions import db
from app.log import LOG
@@ -30,15 +30,7 @@ def new_app():
return app
-def onboarding_1(user):
- if not user.activated:
- LOG.d("User %s is not activated", user)
- return
-
- if not user.notification:
- LOG.d("User %s disable notification setting", user)
- return
-
+def onboarding_send_from_alias(user):
send_email(
user.email,
f"Do you know you can send emails to anyone from your alias?",
@@ -47,6 +39,15 @@ def onboarding_1(user):
)
+def onboarding_pgp(user):
+ send_email(
+ user.email,
+ 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),
+ )
+
+
if __name__ == "__main__":
while True:
# run a job 1h earlier or later is not a big deal ...
@@ -70,9 +71,19 @@ if __name__ == "__main__":
user = User.get(user_id)
# user might delete their account in the meantime
- if user:
- LOG.d("run onboarding_1 for user %s", user)
- onboarding_1(user)
+ # or disable the notification
+ if user and user.notification and user.activated:
+ LOG.d("send onboarding send-from-alias email to user %s", user)
+ onboarding_send_from_alias(user)
+ elif job.name == JOB_ONBOARDING_2:
+ 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 pgp email to user %s", user)
+ onboarding_pgp(user)
else:
LOG.error("Unknown job name %s", job.name)
diff --git a/templates/emails/com/onboarding/pgp.html b/templates/emails/com/onboarding/pgp.html
new file mode 100644
index 00000000..32165067
--- /dev/null
+++ b/templates/emails/com/onboarding/pgp.html
@@ -0,0 +1,40 @@
+{% extends "base.html" %}
+
+{% block content %}
+ {{ render_text("Hi " + user.name) }}
+ {{ render_text("If you happen to use Gmail, Yahoo, Outlook, etc, do you know these services can read your emails?") }}
+
+ {{ render_text("If you want to keep your emails only readable by you, Pretty Good Privacy (PGP) is maybe the solution.") }}
+
+ {{ render_text('Highly recommended, open source and free, PGP is unfortunately not widely supported. However with SimpleLogin most recent PGP support, you can now enable PGP on emails sent to your aliases easily.') }}
+
+ {{ render_text('Without PGP the emails sent to an alias are forwarded by SimpleLogin as-is to your mailbox, leaving anyone in-between or your email service able to read your emails:') }}
+
+
+
+ {{ render_text("With PGP enabled, all emails arrived at SimpleLogin are encrypted with your public key before being forwarded to your mailbox:") }}
+
+
+
+ {{ render_text("You can find more info on our announcement post on https://simplelogin.io/blog/introducing-pgp/") }}
+
+
+ {{ render_text("You can create and manage your PGP keys when adding or editing your mailboxes. Check it out on your mailbox dashboard.") }}
+
+ {{ render_button("Add your PGP key", "https://app.simplelogin.io/dashboard/mailbox") }}
+
+ {{ render_text("Our next important feature is the coming of an iOS app. If you use iPhone or iPad want to help us testing out the app, please reply to this email so we can add you into the TestFlight program.
+") }}
+
+ {{ render_text("For Android users, don't worry: the Android version is already in progress.
+") }}
+
+ {{ 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!.') }}
+
+{% 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/pgp.txt b/templates/emails/com/onboarding/pgp.txt
new file mode 100644
index 00000000..990fa061
--- /dev/null
+++ b/templates/emails/com/onboarding/pgp.txt
@@ -0,0 +1,32 @@
+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 happen to use Gmail, Yahoo, Outlook, etc, do you know these services can read your emails?
+
+If you want to keep your emails only readable by you, Pretty Good Privacy (PGP) is maybe the solution.
+
+Highly recommended, open source and free, PGP is unfortunately not widely supported. However with SimpleLogin most recent PGP support, you can now enable PGP on emails sent to your aliases easily.
+
+Without PGP the emails sent to an alias are forwarded by SimpleLogin as-is to your mailbox, leaving anyone in-between or your email service able to read your emails:
+
+https://simplelogin.io/blog/without-pgp.png
+
+With PGP enabled, all emails arrived at SimpleLogin are encrypted with your public key before being forwarded to your mailbox:
+
+https://simplelogin.io/blog/with-pgp.png
+
+You can find more info on our announcement post on https://simplelogin.io/blog/introducing-pgp/
+
+You can create and manage your PGP keys when adding or editing your mailboxes. Check it out on your mailbox dashboard at https://app.simplelogin.io/dashboard/mailbox
+
+Our next important feature is the coming of an iOS app. If you use iPhone or iPad want to help us testing out the app, please reply to this email so we can add you into the TestFlight program.
+
+For Android users, don't worry: the Android version is already in progress.
+
+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