diff --git a/job_runner.py b/job_runner.py index 6674964a..90b018ab 100644 --- a/job_runner.py +++ b/job_runner.py @@ -198,13 +198,18 @@ def process_job(job: Job): onboarding_mailbox(user) elif job.name == config.JOB_ONBOARDING_4: user_id = job.payload.get("user_id") - user = User.get(user_id) + user: 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) + # if user only has 1 mailbox which is Proton then do not send PGP onboarding email + mailboxes = user.mailboxes() + if len(mailboxes) == 1 and mailboxes[0].is_proton(): + LOG.d("Do not send onboarding PGP email to Proton mailbox") + else: + LOG.d("send onboarding pgp email to user %s", user) + onboarding_pgp(user) elif job.name == config.JOB_BATCH_IMPORT: batch_import_id = job.payload.get("batch_import_id")