mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
dev: update email templates for test email
This commit is contained in:
parent
7ca7b80c89
commit
9122d34e8b
@ -1,6 +1,9 @@
|
||||
from django.core.mail import EmailMultiAlternatives, get_connection
|
||||
from django.core.management import BaseCommand, CommandError
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.html import strip_tags
|
||||
|
||||
# Module imports
|
||||
from plane.license.utils.instance_value import get_email_configuration
|
||||
|
||||
|
||||
@ -37,10 +40,10 @@ class Command(BaseCommand):
|
||||
timeout=30,
|
||||
)
|
||||
# Prepare email details
|
||||
subject = "Email Notification from Plane"
|
||||
message = (
|
||||
"This is a sample email notification sent from Plane application."
|
||||
)
|
||||
subject = "Test email from Plane"
|
||||
|
||||
html_content = render_to_string("emails/test_email.html")
|
||||
text_content = strip_tags(html_content)
|
||||
|
||||
self.stdout.write(self.style.SUCCESS("Trying to send test email..."))
|
||||
|
||||
@ -48,11 +51,14 @@ class Command(BaseCommand):
|
||||
try:
|
||||
msg = EmailMultiAlternatives(
|
||||
subject=subject,
|
||||
body=message,
|
||||
body=text_content,
|
||||
from_email=EMAIL_FROM,
|
||||
to=[receiver_email],
|
||||
to=[
|
||||
receiver_email,
|
||||
],
|
||||
connection=connection,
|
||||
)
|
||||
msg.attach_alternative(html_content, "text/html")
|
||||
msg.send()
|
||||
self.stdout.write(self.style.SUCCESS("Email successfully sent"))
|
||||
except Exception as e:
|
||||
|
6
apiserver/templates/emails/test_email.html
Normal file
6
apiserver/templates/emails/test_email.html
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<p>This is a test email sent to verify if email configuration is working as expected in your Plane instance.</p>
|
||||
|
||||
<p>Regards,</br> Team Plane </p>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user