Customize email footer for self-hosted instance

This commit is contained in:
Andreas Dueren
2025-11-23 08:21:12 -06:00
parent 00433e664f
commit a64c28761b

117
start.sh
View File

@@ -684,6 +684,123 @@ sync_dir "$APP_DIR/server/mail-templates" "$MUSEUM_RUNTIME_DIR/mail-templates"
sync_dir "$APP_DIR/server/assets" "$MUSEUM_RUNTIME_DIR/assets"
sync_dir "$APP_DIR/data" "$MUSEUM_RUNTIME_DIR/data"
customize_mail_templates() {
local base_template="$MUSEUM_RUNTIME_DIR/mail-templates/base.html"
if [ ! -f "$base_template" ]; then
return
fi
cat > "$base_template" <<EOF_BASE_TEMPLATE
{{define "base"}}
<!DOCTYPE html>
<html>
<meta content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<style>
body {
background-color: #f0f1f3;
font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;
font-size: 16px;
line-height: 27px;
margin: 0;
color: #444;
}
pre {
background: #f4f4f4f4;
padding: 2px;
}
table {
width: 100%;
border: 1px solid #ddd;
}
table td {
border-color: #ddd;
padding: 5px;
}
.wrap {
background-color: #fff;
padding: 30px;
max-width: 525px;
margin: 0 auto;
border-radius: 5px;
}
.button {
background: #0055d4;
border-radius: 3px;
text-decoration: none !important;
color: #fff !important;
font-weight: bold;
padding: 10px 30px;
display: inline-block;
}
.button:hover {
background: #111;
}
.footer {
text-align: center;
font-size: 12px;
color: #888;
padding: 16px;
}
.gutter {
padding: 30px;
}
img {
max-width: 100%;
height: auto;
}
a {
color: #0055d4;
}
a:hover {
color: #111;
}
@media screen and (max-width: 600px) {
.wrap {
max-width: auto;
}
.gutter {
padding: 10px;
}
}
</style>
<body>
<div class="gutter" style="padding: 4px">&nbsp;</div>
<div class="wrap" style="background-color: #ffffff; padding: 2px 30px 30px 30px; max-width: 525px; margin: 0 auto; border-radius: 5px; font-size: 16px;">
<main>
{{block "content" .}} Default Content {{end}}
</main>
</div>
<br />
<div class="footer">
<p style="margin-bottom: 4px;">
<strong><a href="$BASE_URL" target="_blank" style="color: #555;">$BASE_URL</a></strong>
</p>
<p style="margin: 0;">
This email was sent by a self-hosted instance of the open source Ente application.
</p>
</div>
</body>
</html>
{{end}}
EOF_BASE_TEMPLATE
chown cloudron:cloudron "$base_template"
}
customize_mail_templates
if [ ! -x "$MUSEUM_BIN" ]; then
log ERROR "Museum binary not found at $MUSEUM_BIN"
exit 1