Use link to png logo in emails

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-10-15 18:13:48 +02:00
parent 740a361ba8
commit 87ac7485f3
8 changed files with 37 additions and 35 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -26,6 +26,8 @@ import (
var Templates embed.FS
const (
logoURLFormat = "https://%s/logos/probo.png"
subjectConfirmEmail = "Confirm your email address"
subjectPasswordReset = "Reset your password"
subjectInvitation = "Invitation to join %s on Probo"
@@ -52,97 +54,111 @@ var (
trustCenterAccessTextTemplate = texttemplate.Must(texttemplate.ParseFS(Templates, "dist/trust-center-access.txt.tmpl"))
)
func RenderConfirmEmail(fullName, confirmationUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderConfirmEmail(hostname, fullName, confirmationUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
ConfirmationUrl string
LogoURL string
}{
FullName: fullName,
ConfirmationUrl: confirmationUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(confirmEmailTextTemplate, confirmEmailHTMLTemplate, data)
return subjectConfirmEmail, textBody, htmlBody, err
}
func RenderPasswordReset(fullName, resetUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderPasswordReset(hostname, fullName, resetUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
ResetUrl string
LogoURL string
}{
FullName: fullName,
ResetUrl: resetUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(passwordResetTextTemplate, passwordResetHTMLTemplate, data)
return subjectPasswordReset, textBody, htmlBody, err
}
func RenderInvitation(fullName, organizationName, invitationUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderInvitation(hostname, fullName, organizationName, invitationUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
OrganizationName string
InvitationUrl string
LogoURL string
}{
FullName: fullName,
OrganizationName: organizationName,
InvitationUrl: invitationUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(invitationTextTemplate, invitationHTMLTemplate, data)
return fmt.Sprintf(subjectInvitation, organizationName), textBody, htmlBody, err
}
func RenderDocumentSigning(fullName, organizationName, signingUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderDocumentSigning(hostname, fullName, organizationName, signingUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
OrganizationName string
SigningUrl string
LogoURL string
}{
FullName: fullName,
OrganizationName: organizationName,
SigningUrl: signingUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(documentSigningTextTemplate, documentSigningHTMLTemplate, data)
return fmt.Sprintf(subjectDocumentSigning, organizationName), textBody, htmlBody, err
}
func RenderDocumentExport(fullName, downloadUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderDocumentExport(hostname, fullName, downloadUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
DownloadUrl string
LogoURL string
}{
FullName: fullName,
DownloadUrl: downloadUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(documentExportTextTemplate, documentExportHTMLTemplate, data)
return subjectDocumentExport, textBody, htmlBody, err
}
func RenderFrameworkExport(fullName, downloadUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderFrameworkExport(hostname, fullName, downloadUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
DownloadUrl string
LogoURL string
}{
FullName: fullName,
DownloadUrl: downloadUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(frameworkExportTextTemplate, frameworkExportHTMLTemplate, data)
return subjectFrameworkExport, textBody, htmlBody, err
}
func RenderTrustCenterAccess(fullName, organizationName, accessUrl string) (subject string, textBody string, htmlBody *string, err error) {
func RenderTrustCenterAccess(hostname, fullName, organizationName, accessUrl string) (subject string, textBody string, htmlBody *string, err error) {
data := struct {
FullName string
OrganizationName string
AccessUrl string
LogoURL string
}{
FullName: fullName,
OrganizationName: organizationName,
AccessUrl: accessUrl,
LogoURL: fmt.Sprintf(logoURLFormat, hostname),
}
textBody, htmlBody, err = renderEmail(trustCenterAccessTextTemplate, trustCenterAccessHTMLTemplate, data)

View File

@@ -1,34 +1,13 @@
import { Img } from '@react-email/components';
import * as React from 'react';
export function ProboLogo() {
return (
<svg width="220" height="60" viewBox="0 0 1098 300" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clipPath="url(#clip0_342_2394)">
<rect width="300" height="300" rx="70" fill="#101E1C"/>
<g clipPath="url(#clip1_342_2394)">
<rect width="320" height="320" transform="translate(-9.69238 -10)" fill="#101E1C"/>
<path d="M238.194 83.0279C274.406 137.651 160.574 258.266 -29.4255 142.266" stroke="#E6FF03" strokeWidth="42.6667"/>
<path d="M238.194 83.0279C274.406 137.651 160.574 258.266 -29.4255 142.266" stroke="url(#paint0_linear_342_2394)" strokeWidth="42.6667"/>
<path d="M220.112 94.3364C226.365 104.327 239.53 107.363 249.515 101.118C259.501 94.873 262.527 81.7113 256.274 71.7206L220.112 94.3364ZM97.9074 324.933L118.61 319.8C87.9762 196.62 115.788 133.041 146.656 105.377C162.52 91.1595 180.159 85.27 194.453 84.9721C209.505 84.6583 217.534 90.218 220.112 94.3364L238.193 83.0285L256.274 71.7206C242.999 50.5115 217.649 41.8122 193.53 42.315C168.652 42.8335 141.327 52.8361 118.165 73.5935C70.9833 115.879 44.5053 198.58 77.2047 330.066L97.9074 324.933Z" fill="#E6FF03"/>
</g>
</g>
<path d="M819.441 0V91.5413C820.437 90.5458 822.066 89.5503 824.057 88.2381C826.365 86.609 830.98 84.618 837.903 82.3103C844.827 80.0025 852.383 78.6902 859.985 78.6902C880.393 78.6902 897.543 85.6135 911.345 99.7769C925.191 113.623 932.069 130.411 932.069 150.502C932.069 170.594 925.146 187.065 910.983 201.228C897.136 215.391 880.031 222.315 859.94 222.315C839.849 222.315 823.378 215.708 809.215 202.902C795.051 190.051 787.811 172.268 787.811 149.552V0H819.441ZM859.94 109.008C837.225 109.008 819.441 126.475 819.441 150.502C819.441 174.53 836.546 191.997 859.94 191.997C883.335 191.997 900.439 174.214 900.439 150.502C900.439 126.791 882.656 109.008 859.94 109.008Z" fill="#101E1C"/>
<path d="M643.005 99.781C657.168 85.6176 673.956 78.6943 694.047 78.6943C714.139 78.6943 730.61 85.6176 744.773 99.781C758.936 113.944 765.86 130.732 765.86 150.507C765.86 170.281 758.936 187.386 744.773 201.549C730.61 215.395 713.822 222.319 694.047 222.319C674.273 222.319 657.168 215.395 643.005 201.549C628.842 187.386 621.918 170.598 621.918 150.507C621.918 130.415 628.842 113.944 643.005 99.781ZM653.548 150.507C653.548 162.679 657.485 172.589 665.087 180.462C673.006 188.019 682.554 192.001 694.047 192.001C705.541 192.001 715.134 188.064 722.691 180.462C730.61 172.543 734.546 162.679 734.546 150.507C734.546 138.334 730.61 128.424 722.691 120.868C715.134 112.949 705.586 109.012 694.047 109.012C682.509 109.012 672.961 112.949 665.087 120.868C657.53 128.424 653.548 138.334 653.548 150.507Z" fill="#101E1C"/>
<path d="M975.084 99.781C989.248 85.6176 1006.04 78.6943 1026.13 78.6943C1046.22 78.6943 1062.69 85.6176 1076.85 99.781C1091.02 113.944 1097.94 130.732 1097.94 150.507C1097.94 170.281 1091.02 187.386 1076.85 201.549C1062.69 215.395 1045.9 222.319 1026.13 222.319C1006.35 222.319 989.248 215.395 975.084 201.549C960.921 187.386 953.998 170.598 953.998 150.507C953.998 130.415 960.921 113.944 975.084 99.781ZM985.628 150.507C985.628 162.679 989.565 172.589 997.167 180.462C1005.09 188.019 1014.63 192.001 1026.13 192.001C1037.62 192.001 1047.21 188.064 1054.77 180.462C1062.69 172.543 1066.63 162.679 1066.63 150.507C1066.63 138.334 1062.69 128.424 1054.77 120.868C1047.21 112.949 1037.67 109.012 1026.13 109.012C1014.59 109.012 1005.04 112.949 997.167 120.868C989.61 128.424 985.628 138.334 985.628 150.507Z" fill="#101E1C"/>
<path d="M411.63 209.454V299.999H380V151.488C380 128.772 387.24 110.989 401.403 98.138C415.567 85.2869 432.671 78.7256 452.129 78.7256C471.587 78.7256 489.325 85.6489 503.171 99.8122C517.335 113.976 524.258 130.763 524.258 150.538C524.258 170.312 517.335 187.417 503.533 201.58C489.687 215.427 472.582 222.35 452.174 222.35C436.699 222.35 421.857 217.101 416.291 212.802L411.675 209.499L411.63 209.454ZM452.129 108.998C428.735 108.998 411.63 126.781 411.63 150.493C411.63 174.204 429.413 191.987 452.129 191.987C474.845 191.987 492.628 174.52 492.628 150.493C492.628 126.465 474.845 108.998 452.129 108.998Z" fill="#101E1C"/>
<path d="M576.136 220.64H544.868V136.973C544.868 96.4737 567.583 80.3193 598.218 80.3193H605.775V110.637H599.847C584.054 110.637 576.136 119.551 576.136 136.973V220.64Z" fill="#101E1C"/>
<defs>
<linearGradient id="paint0_linear_342_2394" x1="216.193" y1="173.319" x2="-18.0923" y2="173.319" gradientUnits="userSpaceOnUse">
<stop stopColor="#101E1C" stopOpacity="0"/>
<stop offset="1" stopColor="#101E1C"/>
</linearGradient>
<clipPath id="clip0_342_2394">
<rect width="300" height="300" rx="70" fill="white"/>
</clipPath>
<clipPath id="clip1_342_2394">
<rect width="320" height="320" fill="white" transform="translate(-9.69238 -10)"/>
</clipPath>
</defs>
</svg>
<Img
src={'{{.LogoURL}}'}
alt="Probo"
width="220"
height="60"
/>
);
}

View File

@@ -191,6 +191,7 @@ func (s Service) ForgetPassword(
}
subject, textBody, htmlBody, err := emails.RenderPasswordReset(
s.hostname,
user.FullName,
resetPasswordUrl.String(),
)
@@ -292,6 +293,7 @@ func (s Service) SignUp(
}
subject, textBody, htmlBody, err := emails.RenderConfirmEmail(
s.hostname,
user.FullName,
confirmationUrl.String(),
)

View File

@@ -702,6 +702,7 @@ func (s *TenantAuthzService) InviteUserToOrganization(
}
subject, textBody, htmlBody, err := emails.RenderInvitation(
s.hostname,
recipientName,
organization.Name,
invitationURL,

View File

@@ -455,6 +455,7 @@ func (s *DocumentService) SendSigningNotifications(
}
subject, textBody, htmlBody, err := emails.RenderDocumentSigning(
s.svc.hostname,
people.FullName,
organization.Name,
signRequestURL.String(),
@@ -1570,6 +1571,7 @@ func (s *DocumentService) SendExportEmail(
}
subject, textBody, htmlBody, err := emails.RenderDocumentExport(
s.svc.hostname,
recipientName,
downloadURL,
)

View File

@@ -709,6 +709,7 @@ func (s FrameworkService) SendExportEmail(
}
subject, textBody, htmlBody, err := emails.RenderFrameworkExport(
s.svc.hostname,
recipientName,
downloadURL,
)

View File

@@ -408,6 +408,7 @@ func (s TrustCenterAccessService) sendTrustCenterAccessEmail(
accessURL string,
) error {
subject, textBody, htmlBody, err := emails.RenderTrustCenterAccess(
s.svc.hostname,
name,
companyName,
accessURL,