Skip to content

Commit

Permalink
Create welcome_mail.py
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-intuitem committed May 30, 2024
1 parent e2ac023 commit 566b6cd
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions backend/core/management/commands/welcome_mail.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 566b6cd

Please sign in to comment.