From 566b6cdd0ee405b42b4d18877d906038ff886090 Mon Sep 17 00:00:00 2001 From: eric-intuitem <71850047+eric-intuitem@users.noreply.github.com> Date: Thu, 30 May 2024 17:29:42 +0200 Subject: [PATCH] Create welcome_mail.py --- .../core/management/commands/welcome_mail.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 backend/core/management/commands/welcome_mail.py diff --git a/backend/core/management/commands/welcome_mail.py b/backend/core/management/commands/welcome_mail.py new file mode 100644 index 000000000..0644f6134 --- /dev/null +++ b/backend/core/management/commands/welcome_mail.py @@ -0,0 +1,20 @@ +from django.core.management.base import BaseCommand +from core.models import * +from iam.models import User, Folder +from ciso_assistant.settings import CISO_ASSISTANT_SUPERUSER_EMAIL + + +class Command(BaseCommand): + help = "Send welcome email" + + def handle(self, *args, **kwargs): + admin = User.objects.get(email=CISO_ASSISTANT_SUPERUSER_EMAIL) + print(admin) + try: + admin.mailing( + email_template_name="registration/first_connexion_email.html", + subject="Welcome to CISO Assistant!", + ) + self.stdout.write("welcome mail sent") + except Exception as e: + self.stdout.write("cannot send welcome mail")