feat: instance created notification email template with nicer body

wip-site
Aravinth Manivannan 2022-07-04 14:57:34 +05:30 committed by Gitea
parent 63f4f987a9
commit 5e5ce02759
2 changed files with 26 additions and 11 deletions

View File

@ -0,0 +1,11 @@
Hello {{ username }}!,
The deployment job has run to completion and your Hostea instance is now online!
Credentials to admin account was sent in an earlier email, please contact
support if didn't receive it.
Gitea: {{ gitea_uri }}
Woodpecker CI: {{ woodpecker_uri }}
Cheers,
Hostea team

View File

@ -53,19 +53,23 @@ class Worker(Thread):
job = self.job
self.job = None
email = job.instance.owned_by.email
ctx = {
"gitea_uri": gitea_uri,
"woodpecker_uri": woodpecker,
"username": job.instance.owned_by.username,
}
body = render_to_string(
"infrastructure/emails/instance-created.txt",
context=ctx,
)
sender = settings.HOSTEA["EMAIL_SENDER_ADDRESS"]
send_mail(
subject="[Hostea] Your Hostea instance is now online!",
message=f"""
Hello,
The deployment job has run to completion and your Hostea instance is now online!
Credentials to admin account was sent in an earlier email, please contact
support if didn't receive it.
Gitea: {gitea_uri}
Woodpecker CI: {woodpecker}
""",
from_email="No reply Hostea<no-reply@exampl.org>", # TODO read from settings.py
message=body,
from_email=f"No reply Hostea<{sender}>", # TODO read from settings.py
recipient_list=[email],
)
job.delete()