Valerter email notifications use Jinja2 templates (via minijinja) to customize the email body content.
By default, emails use a built-in template (default-email.html.j2) that provides a clean, responsive design with color-coded headers and professional styling.
You can provide your own template via:
| Option | Description |
|---|---|
body_template |
Inline Jinja2 template string |
body_template_file |
Path to template file (relative to config dir or absolute) |
Priority: body_template_file > body_template > default template
| Variable | Type | Description |
|---|---|---|
title |
string | Alert title (from message template) |
body |
string | Alert body (from message template) |
rule_name |
string | Name of the rule that triggered |
accent_color |
string | null | Accent color from template (e.g., #ff0000) |
log_timestamp |
string | Original log timestamp in ISO 8601 format (for VictoriaLogs search) |
log_timestamp_formatted |
string | Human-readable timestamp (respects timestamp_timezone setting) |
Common patterns:
{# Variable output #}
{# With default value #}
{# Filters #}
{# Conditionals #}
{# Comments (not rendered) #}
{# This is a comment #}
notifiers:
email-ops:
type: email
smtp:
host: smtp.example.com
port: 587
from: "valerter@example.com"
to:
- "ops@example.com"
subject_template: "[] "
notifiers:
email-custom:
type: email
smtp:
host: smtp.example.com
port: 587
from: "valerter@example.com"
to:
- "ops@example.com"
subject_template: "[] "
body_template_file: "templates/my-alert.html.j2"
notifiers:
email-inline:
type: email
smtp:
host: smtp.example.com
port: 587
from: "valerter@example.com"
to:
- "ops@example.com"
subject_template: "Alert: "
body_template: |
<html>
<body>
<h1 style="color: "></h1>
<p></p>
<hr>
<small>Rule: </small>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div style="padding: 20px; border-left: 4px solid ;">
<h1></h1>
<p></p>
<small>
Rule: <code></code><br>
Log time:
</small>
</div>
</body>
</html>
<style> blocks wellWe recommend .html.j2 extension (e.g., my-alert.html.j2), but any extension works.
HTML auto-escaping is enabled - All variables are automatically escaped to prevent XSS attacks from malicious log data.
For example, <script>alert('xss')</script> in a log becomes:
<script>alert('xss')</script>