feat: instance created notification email template with nicer body
parent
63f4f987a9
commit
5e5ce02759
|
@ -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
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue